diff --git a/app/views/stopwatch/_settings.html.erb b/app/views/stopwatch/_settings.html.erb index 873d442..7d08f64 100644 --- a/app/views/stopwatch/_settings.html.erb +++ b/app/views/stopwatch/_settings.html.erb @@ -2,3 +2,8 @@ <%= select_tag 'settings[default_activity]', options_from_collection_for_select( [['always_ask', t('.label_always_ask')], ['system', t('.label_system')]] + TimeEntryActivity.system.active.to_a.pluck(:id, :name), :first, :last, Stopwatch.settings['default_activity'] ) %>
+ ++ + <%= check_box_tag 'settings[highlighted_links]', 1, Setting.plugin_stopwatch[:highlighted_links] %> +
\ No newline at end of file diff --git a/app/views/stopwatch/hooks/_layouts_base_html_head.html.erb b/app/views/stopwatch/hooks/_layouts_base_html_head.html.erb index 5674479..1688d9f 100644 --- a/app/views/stopwatch/hooks/_layouts_base_html_head.html.erb +++ b/app/views/stopwatch/hooks/_layouts_base_html_head.html.erb @@ -1,2 +1,3 @@ <%= javascript_include_tag "stopwatch", plugin: "stopwatch" %> <%= stylesheet_link_tag "stopwatch", plugin: "stopwatch" %> +<%= stylesheet_link_tag "highlighted_links", plugin: "stopwatch" if Stopwatch.highlighted_links %> \ No newline at end of file diff --git a/assets/stylesheets/highlighted_links.css b/assets/stylesheets/highlighted_links.css new file mode 100644 index 0000000..7f5c5c7 --- /dev/null +++ b/assets/stylesheets/highlighted_links.css @@ -0,0 +1,22 @@ +a.stopwatch_issue_timer[href*="stop"] { + color: red; +} + +a.stopwatch_issue_timer[href*="start"] { + color: limegreen; +} + +/* Mobile only */ +@media (max-width: 899px) { + a.stopwatch_issue_timer[href*="stop"] { + color: red; + background-color: #ffe5e5; + border: 1px solid red; + } + + a.stopwatch_issue_timer[href*="start"] { + color: limegreen; + background-color: #eaffea; + border: 1px solid limegreen; + } +} \ No newline at end of file diff --git a/assets/stylesheets/stopwatch.css b/assets/stylesheets/stopwatch.css index 70d5612..00508e5 100644 --- a/assets/stylesheets/stopwatch.css +++ b/assets/stylesheets/stopwatch.css @@ -1,26 +1,3 @@ tr.time-entry.running td.hours { color: red; -} - -a.stopwatch_issue_timer[href*="stop"] { - color: red; -} - -a.stopwatch_issue_timer[href*="start"] { - color: limegreen; -} - -/* Mobile only */ -@media (max-width: 899px) { - a.stopwatch_issue_timer[href*="stop"] { - color: red; - background-color: #ffe5e5; - border: 1px solid red; - } - - a.stopwatch_issue_timer[href*="start"] { - color: limegreen; - background-color: #eaffea; - border: 1px solid limegreen; - } } \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 9ffca4d..0ba535d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -5,6 +5,7 @@ en: settings: label_always_ask: 'Always ask' label_default_activity: 'Default activity for "Start tracking"' + label_highlighted_links: "Color-code Start/Stop" label_system: 'Use system default' stopwatch_timers: entries_list: diff --git a/lib/stopwatch.rb b/lib/stopwatch.rb index ef60a0f..0fc3faf 100644 --- a/lib/stopwatch.rb +++ b/lib/stopwatch.rb @@ -9,7 +9,6 @@ module Stopwatch Stopwatch::Hooks # just load it end - def self.settings Setting.plugin_stopwatch end @@ -42,4 +41,8 @@ module Stopwatch return activities.detect{ |a| a == default || a.parent == default } end end + + def self.highlighted_links + settings[:highlighted_links] + end end