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 | 183 | @article.destroy |
184 | 184 | session[:notice] = _("\"#{@article.name}\" was removed.") |
185 | 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 | 187 | redirect_to referer |
188 | 188 | elsif @article.parent |
189 | 189 | redirect_to @article.parent.url | ... | ... |
app/views/cms/edit.rhtml
... | ... | @@ -38,6 +38,7 @@ |
38 | 38 | |
39 | 39 | <% button_bar do %> |
40 | 40 | <%= submit_button :save, _('Save') %> |
41 | + | |
41 | 42 | <% if @back_to %> |
42 | 43 | <%= button :cancel, _('Cancel'), @back_to %> |
43 | 44 | <% elsif @parent_id || @article.parent %> |
... | ... | @@ -45,6 +46,11 @@ |
45 | 46 | <% else %> |
46 | 47 | <%= button :cancel, _('Cancel'), :action => 'index' %> |
47 | 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 | 54 | <% end %> |
49 | 55 | <% end %> |
50 | 56 | </div> | ... | ... |
public/stylesheets/application.css
... | ... | @@ -3158,6 +3158,10 @@ table.cms-articles .icon:hover { |
3158 | 3158 | max-width: 100%; |
3159 | 3159 | } |
3160 | 3160 | |
3161 | +.controller-cms .button-bar .icon-delete { | |
3162 | + float: right; | |
3163 | +} | |
3164 | + | |
3161 | 3165 | /************* external blog options *****************/ |
3162 | 3166 | |
3163 | 3167 | .controller-cms #fetch-external-feed { | ... | ... |