Skip to content

Commit

Permalink
Merge pull request #840 from e-tobi/master
Browse files Browse the repository at this point in the history
Fixing a bunch of issues
  • Loading branch information
mvz committed Jan 26, 2018
2 parents 8b990ef + 676e75c commit 0fd84f2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion publify_core/app/controllers/admin/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ def set_page

# Never trust parameters from the scary internet, only allow the white list through.
def page_params
params.require(:page).permit(:title, :body, :name, :state, :text_filter)
params.require(:page).permit(:title, :body, :name, :state, :text_filter_id)
end
end
12 changes: 10 additions & 2 deletions publify_core/app/controllers/admin/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def index; end
def update
@user.resource = upload_avatar if params[:user][:filename]

if @user.update(user_params)
if @user.update(update_params)
redirect_to admin_profiles_url, notice: I18n.t('admin.profiles.index.success')
else
render :index
Expand Down Expand Up @@ -37,11 +37,19 @@ def set_user
def user_params
params.require(:user).permit(:login, :password, :password_confirmation,
:email, :firstname, :lastname, :nickname,
:display_name, :notify_via_email,
:name, :notify_via_email,
:notify_on_new_articles, :notify_on_comments,
:text_filter_id, :state,
:twitter_account, :twitter_oauth_token,
:twitter_oauth_token_secret, :description,
:url, :msn, :yahoo, :jabber, :aim, :twitter)
end

def update_params
if user_params[:password].blank? && user_params[:password_confirmation].blank?
user_params.except(:password_confirmation, :password)
else
user_params
end
end
end
4 changes: 2 additions & 2 deletions publify_core/app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def set_user
def user_params
params.require(:user).permit(:login, :password, :password_confirmation,
:email, :firstname, :lastname, :nickname,
:display_name, :notify_via_email,
:name, :notify_via_email,
:notify_on_new_articles, :notify_on_comments,
:profile, :text_filter, :state,
:profile, :text_filter_id, :state,
:twitter_account, :twitter_oauth_token,
:twitter_oauth_token_secret, :description,
:url, :msn, :yahoo, :jabber, :aim, :twitter)
Expand Down
2 changes: 1 addition & 1 deletion publify_core/app/views/admin/content/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<div class="row">
<div class="col-md-2" id="quicktags-block">
<div id="quicktags" class="pull-right">
<script type="text/javascript">edToolbar('article_body_and_extended', '<%= @article.text_filter %>');</script>
<script type="text/javascript">edToolbar('article_body_and_extended', '<%= @article.text_filter.name %>');</script>
</div>
</div>
<div class="col-md-8">
Expand Down
12 changes: 6 additions & 6 deletions publify_core/app/views/admin/pages/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<span class='pull-right'>
<%= link_to(t('.cancel'), {action: 'index'}, {class: 'btn btn-default'}) %>
<!-- Button trigger modal -->
<button class="btn btn-success" data-toggle="modal" data-target="#publish">
<button class="btn btn-success" data-toggle="modal" type="button" data-target="#publish">
<%= controller.action_name == "new" ? t(".publish") : t(".save") %>
</button>
</span>
Expand All @@ -34,7 +34,7 @@
<div class='row'>
<div class='col-md-2' id='quicktags-block'>
<div id='quicktags' class='pull-right'>
<script type="text/javascript">edToolbar('page_body', '<%= @page.text_filter %>');</script>
<script type="text/javascript">edToolbar('page_body', '<%= @page.text_filter.name %>');</script>
</div>
</div>

Expand Down Expand Up @@ -69,11 +69,11 @@
<fieldset>
<legend><%= t(".publish_settings") %></legend>
<div class='control-group'>
<%= t(".status") %>: <strong><%= (@page.published?) ? t(".published") : t(".offline") %></strong>
<%= t(".status") %>: <strong><%= @page.state %></strong>
<%= toggle_element('status') %>
<div id='status' class='collapse'>
<label for="page_published" class='checkbox'>
<%= check_box 'page', 'published?' %>
<%= check_box 'page', 'state', {}, 'published', '' %>
<%= t(".online")%>
</label>
<p><span class='btn btn-default btn-mini'><%= toggle_element 'status', "OK" %></span></p>
Expand All @@ -82,8 +82,8 @@
<div class='control-group'>
<%= t(".article_filter") %>: <strong><%= @page.text_filter.description %></strong> <%= toggle_element 'text_filter' %>
<div id='text_filter' class='collapse'>
<select name="page[text_filter]" id="text_filter" class='form-control'>
<%= options_for_select text_filter_options, @page.text_filter %>
<select name="page[text_filter_id]" id="text_filter" class='form-control'>
<%= options_for_select text_filter_options_with_id, @page.text_filter.id %>
</select>
<p><span class='btn btn-mini btn-default'><%= toggle_element 'text_filter', "OK" %></span></p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion publify_core/app/views/articles/view_page.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div id="viewpage" >
<%= html @page %>
<%= raw html @page %>
</div>
2 changes: 1 addition & 1 deletion themes/bootstrap-2/views/articles/view_page.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<h1 class='page-header'><%= link_to_permalink(@page, @page.title) %></h1>
<%= @page.html %>
<%= raw @page.html %>

0 comments on commit 0fd84f2

Please sign in to comment.