Commit 64b41e23d7dc0cfb29349422e5d310fc968c3101
1 parent
1b7dcab6
Exists in
master
and in
29 other branches
Add button to delete content on edition
Showing
3 changed files
with
11 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -183,7 +183,7 @@ class CmsController < MyProfileController | @@ -183,7 +183,7 @@ class CmsController < MyProfileController | ||
183 | @article.destroy | 183 | @article.destroy |
184 | session[:notice] = _("\"#{@article.name}\" was removed.") | 184 | session[:notice] = _("\"#{@article.name}\" was removed.") |
185 | referer = ActionController::Routing::Routes.recognize_path URI.parse(request.referer).path rescue nil | 185 | referer = ActionController::Routing::Routes.recognize_path URI.parse(request.referer).path rescue nil |
186 | - if referer and referer[:controller] == 'cms' | 186 | + if referer and referer[:controller] == 'cms' and referer[:action] != 'edit' |
187 | redirect_to referer | 187 | redirect_to referer |
188 | elsif @article.parent | 188 | elsif @article.parent |
189 | redirect_to @article.parent.url | 189 | redirect_to @article.parent.url |
app/views/cms/edit.rhtml
@@ -38,6 +38,7 @@ | @@ -38,6 +38,7 @@ | ||
38 | 38 | ||
39 | <% button_bar do %> | 39 | <% button_bar do %> |
40 | <%= submit_button :save, _('Save') %> | 40 | <%= submit_button :save, _('Save') %> |
41 | + | ||
41 | <% if @back_to %> | 42 | <% if @back_to %> |
42 | <%= button :cancel, _('Cancel'), @back_to %> | 43 | <%= button :cancel, _('Cancel'), @back_to %> |
43 | <% elsif @parent_id || @article.parent %> | 44 | <% elsif @parent_id || @article.parent %> |
@@ -45,6 +46,11 @@ | @@ -45,6 +46,11 @@ | ||
45 | <% else %> | 46 | <% else %> |
46 | <%= button :cancel, _('Cancel'), :action => 'index' %> | 47 | <%= button :cancel, _('Cancel'), :action => 'index' %> |
47 | <% end %> | 48 | <% end %> |
49 | + | ||
50 | + <% unless @article.new_record? %> | ||
51 | + <%= button :delete, _('Delete'), {:controller => :cms, :action => :destroy, :id => @article}, | ||
52 | + :method => :post, :confirm => delete_article_message(@article) %> | ||
53 | + <% end %> | ||
48 | <% end %> | 54 | <% end %> |
49 | <% end %> | 55 | <% end %> |
50 | </div> | 56 | </div> |
public/stylesheets/application.css
@@ -3158,6 +3158,10 @@ table.cms-articles .icon:hover { | @@ -3158,6 +3158,10 @@ table.cms-articles .icon:hover { | ||
3158 | max-width: 100%; | 3158 | max-width: 100%; |
3159 | } | 3159 | } |
3160 | 3160 | ||
3161 | +.controller-cms .button-bar .icon-delete { | ||
3162 | + float: right; | ||
3163 | +} | ||
3164 | + | ||
3161 | /************* external blog options *****************/ | 3165 | /************* external blog options *****************/ |
3162 | 3166 | ||
3163 | .controller-cms #fetch-external-feed { | 3167 | .controller-cms #fetch-external-feed { |