Skip to content

Commit

Permalink
still not as it should be but feels better now
Browse files Browse the repository at this point in the history
  • Loading branch information
steffen.jurrack committed Sep 14, 2012
1 parent 21a16ef commit 2e4a8c1
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 19 deletions.
29 changes: 20 additions & 9 deletions app/views/banner/_body_bottom.haml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
#banner_area.banner_area
#banner_content{:class=>"banner.banner_#{Setting.plugin_redmine_banner['type']}"}
= textilizable Setting.plugin_redmine_banner['banner_description']
-if User.current.admin? && (params[:controller] != 'settings' && params[:action] != 'settings' && params[:id] != 'redmine_banner')
#banner_edit
= link_to l(:button_edit), {:controller => 'settings', :action => 'plugin', :id => 'redmine_banner'},
{:class => 'icon banner-icon-edit', :title => l(:button_edit)}
%a.icon.banner-icon-off{:href=>"#", :onclick=>"", :title=>"#{l(:banner_off)}"}= l(:button_off)

-if User.current.admin? && (params[:controller] != 'settings' && params[:action] != 'settings' && params[:id] != 'redmine_banner')
#banner_edit
= link_to l(:button_edit), {:controller => 'settings', :action => 'plugin', :id => 'redmine_banner'},
{:class => 'icon banner-icon-edit', :title => l(:button_edit)}

%a.icon.banner-icon-off{:href=>"#",
:onclick=>"if (confirm('#{l(:text_are_you_sure)}')) { new Ajax.Updater('banner_area', '#{url_for(:controller => :banner, :action => 'off', :moderate => 'yes')}',{asynchronous:true, evalScripts:true, parameters:'authenticity_token=' + encodeURIComponent('#{form_authenticity_token}')}); }; hideBanner(); return false;",
:title=>"#{l(:banner_off)}"}
= l(:button_off)
:javascript
function banner_off_moderate(){
if (confirm('#{l(:text_are_you_sure)}')) {
new Ajax.Updater(
'banner_area',
'#{url_for(:controller => :banner, :action => 'off', :moderate => 'yes')}',
{ asynchronous:true,
evalScripts:true,
parameters:'authenticity_token=' + encodeURIComponent('#{form_authenticity_token}')
}
);
};
hideBanner();
return false;
};
32 changes: 22 additions & 10 deletions app/views/banner/_project_body_bottom.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@
#banner_content{:class=>"banner banner_#{banner.style}"}
=textilizable banner.banner_description

-if authorize_for(:banner, :edit)
#banner_edit
= link_to(l(:button_edit),
{:controller => 'projects', :action => "settings", :id => @project, :tab => 'banner'},
{:class => 'icon banner-icon-edit', :title => l(:button_edit)})

%a.icon.banner-icon-off{:href=>"#", :title=>"#{l(:banner_off)}",
:onclick=>"if (confirm('#{l(:text_are_you_sure)}')) { new Ajax.Updater('banner_area','#{url_for(:controller => :banner, :action => 'project_banner_off', :project_id => @project)}',{asynchronous:true, evalScripts:true,parameters:'authenticity_token=' + encodeURIComponent('#{form_authenticity_token}')}); };hideBanner(); return false;"}
= l(:button_off)
-if authorize_for(:banner, :edit)
#banner_edit
= link_to(l(:button_edit),
{:controller => 'projects', :action => "settings", :id => @project, :tab => 'banner'},
{:class => 'icon banner-icon-edit', :title => l(:button_edit)})
%a.icon.banner-icon-off{:href=>"#", :title=>"#{l(:banner_off)}", :onclick=>"banner_off();"}= l(:button_off)

:javascript
document.observe("dom:loaded", function() {
new Insertion.Top($('content'), $('project_banner_area'));
});
});

function banner_off(){
if (confirm('#{l(:text_are_you_sure)}')) {
new Ajax.Updater(
'banner_area',
'#{url_for(:controller => :banner, :action => 'project_banner_off', :project_id => @project)}',
{ asynchronous:true,
evalScripts:true,
parameters:'authenticity_token=' + encodeURIComponent('#{form_authenticity_token}')
}
);
};
hideBanner();
return false;
};

0 comments on commit 2e4a8c1

Please sign in to comment.