Created
November 11, 2012 15:46
-
-
Save benjaminvialle/4055275 to your computer and use it in GitHub Desktop.
Diff from RB for issue 644
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
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css | |
--- a/public/stylesheets/main.css | |
+++ b/public/stylesheets/main.css | |
@@ -968,11 +968,23 @@ input#extra_mark_description{ | |
#role_switch_dialog { | |
background-color:#fff; | |
- padding:10px; | |
- border:10px solid #333; | |
+ padding:10px; | |
+ border:10px solid #333; | |
} | |
-#about_icon, #switch_role_icon { | |
+#help_dialog { | |
+ background: white; | |
+ border:10px solid #333; | |
+ -moz-border-radius: 5px; | |
+ -webkit-border-radius: 5px; | |
+ padding: 10px 110px; | |
+} | |
+ | |
+#help_text { | |
+ width: 105%; | |
+} | |
+ | |
+#about_icon, #switch_role_icon, #help_icon { | |
margin-left: 0.5em; | |
margin-right: 0.5em; | |
margin-top: 2px; | |
@@ -984,6 +996,33 @@ input#extra_mark_description{ | |
text-transform: none; | |
} | |
+.admin_icon { | |
+ position: relative; | |
+ top: 4px; | |
+ height: 20px; | |
+ width: 20px; | |
+ margin-left: 0.5em; | |
+ margin-right: 0.5em; | |
+} | |
+ | |
+.help_link { | |
+ display: block; | |
+ font-size: 1.2em; | |
+ padding: 6px 20px; | |
+} | |
+ | |
+#help_close_dialog { | |
+ margin-top: 20px; | |
+ position: relative; | |
+ left: 25%; | |
+} | |
+ | |
+#github_note_desc { | |
+ position: relative; | |
+ top: 10px; | |
+ left: 40px; | |
+ font-size: smaller; | |
+} | |
.p_modal{ | |
margin-top: 5px; | |
border-top: 1px solid #000000; | |
@@ -2010,7 +2049,7 @@ pre#test_result_content { | |
} | |
.table-button { | |
- margin: 2px; | |
- padding: 2px; | |
- min-width: 0px; | |
+ margin: 2px; | |
+ padding: 2px; | |
+ min-width: 0px; | |
} | |
diff --git a/config/routes.rb b/config/routes.rb | |
--- a/config/routes.rb | |
+++ b/config/routes.rb | |
@@ -284,6 +284,7 @@ Markus::Application.routes.draw do | |
get 'role_switch' | |
get 'clear_role_switch_session' | |
post 'reset_api_key' | |
+ get 'help' | |
end | |
end | |
diff --git a/app/views/main/help.rjs b/app/views/main/help.rjs | |
--- /dev/null | |
+++ b/app/views/main/help.rjs | |
@@ -0,0 +1 @@ | |
+page.replace_html 'help_dialog', :partial => 'help_content' | |
\ No newline at end of file | |
diff --git a/config/locales/en.yml b/config/locales/en.yml | |
--- a/config/locales/en.yml | |
+++ b/config/locales/en.yml | |
@@ -1122,6 +1122,15 @@ en: | |
#app/views/main/_grade_distribution_graph.html.erb | |
grade_distribution: "Grade Distribution" | |
+ #app/views/main/_help_content.html.erb | |
+ help_with_markus: "Help with MarkUs" | |
+ user_guide: "User Guide" | |
+ report_issues: "Report a MarkUs issue" | |
+ view_current_issues: "View current issues" | |
+ report_new_issue: "Report a new issue" | |
+ request_for_enhancement: "Request a new feature or enhancement" | |
+ github_required: "A GitHub account is required for this" | |
+ | |
#Test Framework | |
automated_tests: | |
automated_tests: "Test Framework" | |
diff --git a/app/views/main/_help_content.html.erb b/app/views/main/_help_content.html.erb | |
--- /dev/null | |
+++ b/app/views/main/_help_content.html.erb | |
@@ -0,0 +1,46 @@ | |
+<div id="help_text"> | |
+ <h2> | |
+ <%= I18n.t(:help_with_markus)%> | |
+ </h2> | |
+ | |
+ <% user_guide_url = "https://github.com/MarkUsProject/Markus/wiki/Doc_" %> | |
+ <% user_guide_url += @current_user.admin? ? "Admin" : (@current_user.ta? ? "Grader" : "Student") %> | |
+ <%= link_to(raw(image_tag("icons/information.png", :alt => I18n.t(:user_guide), | |
+ :title => I18n.t(:user_guide), | |
+ :id => "view_user_guide", :class => "admin_icon")) + I18n.t(:user_guide), | |
+ user_guide_url, :class => "help_link", :target => "_blank") -%> | |
+ | |
+ <% if @current_user.admin? %> | |
+ <h2> | |
+ <%= I18n.t(:report_issues)%> | |
+ </h2> | |
+ <% github_issues_url = "https://github.com/MarkUsProject/Markus/issues" %> | |
+ <% new_issue_url = github_issues_url + "/new" %> | |
+ <% new_issue_with_not_triaged_label_url = new_issue_url + "?labels=Not+Triaged" %> | |
+ <% new_issue_with_rfe_label_param = new_issue_url + "?labels=RFE" %> | |
+ <%= link_to(raw(image_tag("icons/bug_go.png", :alt => I18n.t(:view_current_issues), | |
+ :title => I18n.t(:view_current_issues), :id => "view_bugs_icon", | |
+ :class => "admin_icon")) + I18n.t(:view_current_issues), | |
+ github_issues_url, :class => "help_link", :target => "_blank") -%> | |
+ | |
+ <%= link_to(raw(image_tag("icons/bug_add.png", :alt => I18n.t(:report_new_issue), | |
+ :title => I18n.t(:report_new_issue), :id => "report_new_issue_icon", | |
+ :class => "admin_icon")) + raw(I18n.t(:report_new_issue)) + " *", | |
+ new_issue_with_not_triaged_label_url, :class => "help_link", :target => "_blank") -%> | |
+ | |
+ <%= link_to(raw(image_tag("icons/bug_add.png", :alt => I18n.t(:request_for_enhancement), | |
+ :title => I18n.t(:request_for_enhancement), :id => "request_for_enhancement_icon", | |
+ :class => "admin_icon")) + raw(I18n.t(:request_for_enhancement)) + " *", | |
+ new_issue_with_rfe_label_param, :class => "help_link", :target => "_blank") -%> | |
+ <span id="github_note_desc">* <%= I18n.t(:github_required) -%></span> | |
+ <% end %> | |
+ | |
+ <div class="clear"></div> | |
+ | |
+ <%= button_to_function(I18n.t(:cancel), 'help_modal.close()', | |
+ :id => "help_close_dialog", :class => "button", :tabindex => 110) -%> | |
+ | |
+ <script> | |
+ help_modal.open(); | |
+ </script> | |
+</div> | |
diff --git a/app/views/layouts/content.html.erb b/app/views/layouts/content.html.erb | |
--- a/app/views/layouts/content.html.erb | |
+++ b/app/views/layouts/content.html.erb | |
@@ -25,6 +25,7 @@ | |
<%= render :partial => 'layouts/sub_menu' %> | |
<%= render :partial => 'layouts/sub_sub_menu' %> | |
<%= render :partial => 'layouts/about' %> | |
+ <%= render :partial => 'layouts/help' %> | |
<%= render :partial => 'layouts/role_switch' %> | |
<div id="container"> | |
<div id="content"> | |
diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb | |
--- a/app/controllers/main_controller.rb | |
+++ b/app/controllers/main_controller.rb | |
@@ -265,6 +265,11 @@ class MainController < ApplicationController | |
return | |
end | |
+ def help | |
+ # Empty action for remote rjs calls triggered by clicking on the help | |
+ # icon in header. Forward to the view. | |
+ end | |
+ | |
private | |
def login_without_authentication(markus_auth_remote_user) | |
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb | |
--- a/app/views/layouts/_header.html.erb | |
+++ b/app/views/layouts/_header.html.erb | |
@@ -23,6 +23,10 @@ | |
about_main_index_path(), | |
:remote => true) %> | |
+ <%= link_to(image_tag("icons/help.png", :alt => I18n.t(:help), | |
+ :title => I18n.t(:help), :id => "help_icon"), | |
+ help_main_index_path(), :remote => true) -%> | |
+ | |
<span id="admin_logged_in_as"> | |
<% if !session[:real_uid].nil?%> | |
<b> <%= User.find_by_id(session[:real_uid]).first_name %> </b> | |
diff --git a/app/views/layouts/_help.html.erb b/app/views/layouts/_help.html.erb | |
--- /dev/null | |
+++ b/app/views/layouts/_help.html.erb | |
@@ -0,0 +1,24 @@ | |
+<%= javascript_include_tag "livepipe/livepipe.js"%> | |
+<%= javascript_include_tag "livepipe/window.js"%> | |
+<script type="text/javascript"> | |
+//<![CDATA[ | |
+ | |
+var help_modal = null; | |
+ | |
+document.observe("dom:loaded", function(){ | |
+ //Create the modal dialog | |
+ help_modal = new Control.Modal($('help_dialog'), | |
+ { | |
+ overlayOpacity: 0.75, | |
+ className: 'help_modal', | |
+ fade:false | |
+ | |
+ }); | |
+}); | |
+//]]> | |
+</script> | |
+ | |
+<div id="help_dialog" style="display:none;"> | |
+ <!-- Inject help modal here --> | |
+ <div> </div> | |
+</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment