New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up sidebar plugins #812
base: master
Are you sure you want to change the base?
Conversation
end | ||
end | ||
|
||
def parse_request(_contents, _params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put empty method definitions on a single line.
publify_core/app/models/sidebar.rb
Outdated
fields.reduce(sidebar: self) do |hash, field| | ||
hash.merge(field.key => field.current_value(self)) | ||
end | ||
def parse_request(contents, params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use delegate to define delegations.
publify_core/app/models/sidebar.rb
Outdated
end | ||
|
||
def short_name | ||
self.class.short_name | ||
def to_locals_hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use delegate to define delegations.
publify_core/app/models/sidebar.rb
Outdated
configuration.description | ||
end | ||
|
||
def fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use delegate to define delegations.
publify_core/app/models/sidebar.rb
Outdated
else | ||
self.class.fieldmap | ||
end | ||
def display_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use delegate to define delegations.
publify_core/app/models/sidebar.rb
Outdated
|
||
def fields | ||
self.class.fields | ||
def content_partial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use delegate to define delegations.
@@ -10,7 +10,7 @@ def index | |||
def update | |||
@sidebar = Sidebar.where(id: params[:id]).first | |||
@old_s_index = @sidebar.staged_position || @sidebar.active_position | |||
@sidebar.update_attributes params[:configure][@sidebar.id.to_s].permit! | |||
@sidebar.update_attribute :config, params[:configure][@sidebar.id.to_s].permit!.to_hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using update_attribute because it skips validations.
b81b687
to
10bdcc6
Compare
This seemed like a good idea at the time, but now I'm not so sure. |
3cce74b
to
eccd5cb
Compare
eccd5cb
to
cb65f64
Compare
No description provided.