forked from jcppkkk/redmine_stealth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compatibility to Redmine 3.x and full refactoring;
- Loading branch information
1 parent
1c66799
commit 1d20234
Showing
38 changed files
with
345 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
|
||
class StealthController < ApplicationController | ||
unloadable | ||
|
||
before_filter :check_can_stealth | ||
|
||
def toggle | ||
is_cloaked = toggle_for_params | ||
render :js => RedmineStealth.javascript_toggle_statement(is_cloaked) | ||
toggle_by_params | ||
render js: RedmineStealth.javascript_toggle_statement(User.current.stealth_mode_active?) | ||
end | ||
|
||
private | ||
|
||
def toggle_for_params | ||
if params[:toggle] == 'true' | ||
RedmineStealth.cloak! | ||
elsif params[:toggle] == 'false' | ||
RedmineStealth.decloak! | ||
else | ||
RedmineStealth.toggle_stealth_mode! | ||
def toggle_by_params | ||
case params[:toggle] | ||
when 'true' | ||
User.current.activate_stealth_mode | ||
when 'false' | ||
User.current.deactivate_stealth_mode | ||
else | ||
User.current.toggle_stealth_mode | ||
end | ||
end | ||
|
||
def check_can_stealth | ||
render_403 unless User.current.stealth_allowed | ||
render_403 unless User.current.stealth_allowed? | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<fieldset class="box tabular"> | ||
<legend><%=l(:stealth)%></legend> | ||
<p> | ||
<%= form.check_box(:stealth_allowed, | ||
:disabled => (true unless User.current.admin?)) | ||
%> | ||
</p> | ||
</fieldset> | ||
<% if User.current.admin? %> | ||
<fieldset class="box tabular"> | ||
<legend><%= l(:stealth) %></legend> | ||
<p> | ||
<%= form.check_box(:stealth_allowed) %> | ||
</p> | ||
</fieldset> | ||
<% end %> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
|
||
jQuery(function($) { | ||
|
||
window.RedmineStealth = { | ||
|
||
cloak: function(label) { | ||
$('#stealth_toggle').text(label). | ||
data({ params : { toggle : 'false' } }); | ||
$('body').removeClass('stealth_off'). | ||
addClass('stealth_on'); | ||
activate: function(label) { | ||
$('#stealth_toggle').text(label).data({params: {toggle: 'false'}}); | ||
$('body').removeClass('stealth_off').addClass('stealth_on'); | ||
}, | ||
|
||
decloak: function(label) { | ||
$('#stealth_toggle').text(label). | ||
data({ params : { toggle : 'true' } }); | ||
$('body').removeClass('stealth_on'). | ||
addClass('stealth_off'); | ||
deactivate: function(label) { | ||
$('#stealth_toggle').text(label).data({ params : { toggle : 'true' } }); | ||
$('body').removeClass('stealth_on').addClass('stealth_off'); | ||
}, | ||
|
||
notifyFailure: function() { | ||
alert($('#stealth_toggle').data('failure-message')); | ||
} | ||
alert(RedmineStealth.failureMessage); | ||
}, | ||
|
||
failureMessage: "Failed to toggle stealth mode." | ||
}; | ||
|
||
$('#stealth_toggle').bind('ajax:error', RedmineStealth.notifyFailure); | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
|
||
body.stealth_on #top-menu { background: #000; } | ||
body.stealth_on #header { background: #2C4056; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,3 @@ | ||
|
||
if Rails::VERSION::MAJOR >= 3 | ||
|
||
RedmineApp::Application.routes.draw do | ||
post '/stealth/toggle', :to => 'stealth#toggle' | ||
end | ||
|
||
else | ||
|
||
ActionController::Routing::Routes.draw do |map| | ||
map.connect '/stealth/toggle', | ||
:controller => 'stealth', :action => 'toggle', | ||
:conditions => { :method => :post } | ||
end | ||
|
||
RedmineApp::Application.routes.draw do | ||
post '/stealth/toggle', to: 'stealth#toggle' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.