]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3263 improve style of confirmation popup
authorSimon Brandhof <simon.brandhof@gmail.com>
Sun, 23 Sep 2012 19:42:40 +0000 (21:42 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Sun, 23 Sep 2012 19:42:40 +0000 (21:42 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/confirm_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_copy_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_rename_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb
sonar-server/src/main/webapp/javascripts/application.js
sonar-server/src/main/webapp/stylesheets/layout.css
sonar-server/src/main/webapp/stylesheets/style.css

index 4c32642d60963b53536675c56716b9979cf0bba9..f9088055607e52f442592a99ea6d02f21eed1ef8 100644 (file)
@@ -33,6 +33,7 @@ code=Code
 color=Color
 compare=Compare
 configure=Configure
+confirm=Confirm
 copy=Copy
 create=Create
 created=Created
@@ -1149,6 +1150,7 @@ quality_profiles.are_you_sure_want_x_profile_as_default=Are you sure that you wa
 quality_profiles.profile_x_created=Profile "{0}" created. Set it as default or link it to a project to use it for next measures.
 quality_profiles.profile_x_already_exists=This profile already exists: {0}.
 quality_profiles.please_type_profile_name=Please type a profile name.
+quality_profiles.delete_confirm_title=Delete Profile
 quality_profiles.profile_x_deleted=Profile "{0}" is deleted.
 quality_profiles.default_profile_is_x=Default profile is "{0}".
 quality_profiles.profile_x_not_activated=Profile "{0}" is created but not activated.
@@ -1158,6 +1160,7 @@ quality_profiles.profile_name_cant_be_blank=Profile name can not be blank.
 quality_profiles.profile_name_already_exists=This profile name already exists.
 quality_profiles.new_name=New name
 quality_profiles.name_for_new_profile=Name for the new profile
+quality_profiles.delete_confirm_title=Delete Profile
 quality_profiles.are_you_sure_want_delete_profile_x=Are you sure that you want to delete the profile "{0}" ?
 quality_profiles.editing_profile=Editing profile
 quality_profiles.profile_inheritance=Profile inheritance
index b71528641573994db56c9ba544359ef2655ace8a..2d0cc771bae1522efad662df7bdf860252da7bc7 100644 (file)
@@ -19,7 +19,7 @@
 #
 class ConfirmController < ApplicationController
 
-  # GET /confirm?url=<return_to_url>&[t=<title_key]
+  # GET /confirm?url=<return_to_url>[&tk=<title_key][&mk=<message_key][&mp=<message_parameters]
   def index
     render :partial => 'confirm/confirm'
   end
index ad2aa501ad8f6fe3db534586f766217e561642a2..efd21372d8c5ee74a3931fd183e8a4bb5668f5e0 100644 (file)
@@ -725,6 +725,7 @@ module ApplicationHelper
   # ==== Options
   # * <tt>:id</tt> - HTML ID of the button
   # * <tt>:class</tt> - Additional CSS class, generally 'red-button' for deletions
+  # * <tt>:title_key</tt> -
   # * <tt>:message_key</tt> -
   # * <tt>:message_params</tt> -
   # * <tt>:width</tt> - width in pixels
@@ -732,16 +733,18 @@ module ApplicationHelper
   def button_to_action(label, post_url, options={})
     clazz = options[:class]
     id = "id='#{options[:id]}'" if options[:id]
+    title_key = options[:title_key]
     message_key = options[:message_key]
     message_params = options[:message_params]
     width = options[:width]||500
 
     url = "#{ApplicationController.root_context}/confirm?url=#{u post_url}"
+    url += "&tk=#{title_key}" if title_key
     if message_key
-      url += "&k=#{message_key}&"
-      url += message_params.map{|p| "p=#{u p}"}.join('&') if message_params
+      url += "&mk=#{message_key}&"
+      url += message_params.map{|p| "mp=#{u p}"}.join('&') if message_params
     end
 
-    "<a href='#{url}' modal-width='#{width}' class='open-modal button #{clazz}' #{id}>#{label}</a>"
+    "<a href='#{url}' modal-width='#{width}' class='open-modal button #{clazz}' #{id}>#{label}</a>"
   end
 end
index dceb6db2f4a7785e1a56bf9960f4c268e0a75f5d..3f816a061a4e251cb0cb009a5023bf1e0983dd9e 100644 (file)
@@ -1,16 +1,22 @@
 <%
-   message_key = params[:k] || 'are_you_sure'
-   message_params = params[:p] || []
+   title_key = params[:tk] || 'are_you_sure'
+   message_key = params[:mk] || 'are_you_sure'
+   message_params = params[:mp] || []
 %>
 <form id="form-confirm" method="post" action="<%= params[:url] -%>">
   <fieldset>
     <div class="form-head">
-      <img src="<%= ApplicationController.root_context -%>/images/warning.png" style="vertical-align: text-bottom"/>
-      <%= h message(message_key, :params => message_params) -%>
+      <h2><%= h message title_key -%></h2>
+    </div>
+    <div class="form-body">
+      <div class="info">
+        <img src="<%= ApplicationController.root_context -%>/images/information.png" style="vertical-align: text-bottom"/>
+        <%= h message(message_key, :params => message_params) -%>
+      </div>
     </div>
     <div class="form-foot">
-      <input type="submit" value="Confirm"/>
-      <a href="#" onclick="return closeModalWindow()"><%= message('cancel') -%></a>
+      <input type="submit" value="<%= h message('confirm') -%>"/>
+      <a href="#" onclick="return closeModalWindow()"><%= message('cancel') -%></a>
     </div>
   </fieldset>
 </form>
\ No newline at end of file
index 13c26d3096cb84f40e2ea424cb3ba26c9cdf68b8..58f4a342bf0b4f8721cf54a2e1c2c9c1b496dd59 100644 (file)
@@ -6,12 +6,10 @@
     </div>
     <div class="form-body">
       <% if @error %>
-        <div class="form-field">
-          <p class="error"><%= h @error -%></p>
-        </div>
+        <p class="error"><%= h @error -%></p>
       <% end %>
       <div class="form-field">
-        <label for="name">New name</label>
+        <label for="name">New name <em>*</em></label>
         <input id="new-name" name="name" type="text" size="50" maxlength="100"/>
       </div>
     </div>
index 6026b876a279809520df9c32a177699d0bd1525b..47d7b61f919c4c07f74a7ab051bb51bf54f23299 100644 (file)
@@ -5,15 +5,14 @@
     <div class="form-head">
       <h2>Rename Profile: <%= h @profile.name -%></h2>
     </div>
+
     <div class="form-body">
       <% if @error %>
-        <div class="form-field">
-          <p class="error"><%= h @error -%></p>
-        </div>
+        <p class="error"><%= h @error -%></p>
       <% end %>
 
       <div class="form-field">
-        <label for="name">New name</label>
+        <label for="name">New name <em>*</em></label>
         <input id="new-name" name="name" type="text" size="50" maxlength="100"/>
       </div>
     </div>
index fd31c1266d7c148207d69b486e5eec39af22e117..c193a57642ffa6a82eddd5443a1c8fe4afc445fd 100644 (file)
           <% if !profile.default_profile? && administrator? %>
             <%= button_to_action message('set_as_default'), "profiles/set_as_default?id=#{profile.id}",
                                                :id => "activate_#{profile.key.parameterize}",
+                                               :title_key => 'set_as_default',
                                                :message_key => 'quality_profiles.are_you_sure_want_x_profile_as_default',
                                                :message_params => [profile.name] -%>
           <% end %>
               <%= button_to_action message('delete'), "profiles/delete/#{profile.id}",
                                    :class => 'red-button',
                                    :id => "delete_#{profile.key.parameterize}",
+                                   :title_key => 'quality_profiles.delete_confirm_title',
                                    :message_key => 'quality_profiles.are_you_sure_want_delete_profile_x',
                                    :message_params => [profile.name]
               -%>
index a4a1ac077faf787e2430ba83e2c0a4cef8234c09..345802d5411a92851d3c0f90b11d8f66206e9abd 100644 (file)
@@ -268,8 +268,10 @@ Treemap.prototype.onLoaded = function (componentsSize) {
           if ($j('#modal').length) {
             return; // another window is already opening
           }
-          var $dialog = $j('<div id="modal"></div>').appendTo('body');
-          $j.get($link.attr('href'), {}, function (html) {
+          var $dialog = $j('<div id="modal" class="ui-widget-overlay"></div>').appendTo('body');
+          var url = $link.attr('modal-url') || $link.attr('href');
+          $j.get(url,function (html) {
+            $dialog.removeClass('ui-widget-overlay');
             $dialog.html(html);
             $dialog
                 .dialog({
@@ -284,6 +286,10 @@ Treemap.prototype.onLoaded = function (componentsSize) {
                   }
                 });
             $dialog.dialog("open");
+          }).error(function () {
+            alert("Server error. Please contact your administrator.");
+          }).complete(function() {
+            $dialog.removeClass('ui-widget-overlay');
           });
 
           $link.click(function () {
index b6410c2ba6d651a5aef26b0270dbb280d2d52b71..7dd4a87c4186751c015245c6385167816a0ba757 100644 (file)
@@ -250,7 +250,3 @@ body, a {
 .nolayout {
   padding: 10px;
 }
-
-#modal {
-  display: none;
-}
\ No newline at end of file
index 3400d8de54e7dc0c5cb737b4162be7e500eb75d4..169e1377a844dfca35c67f95f9675530f1b86041 100644 (file)
@@ -304,6 +304,12 @@ h4, .h4 {
   padding: 4px;
 }
 
+.info {
+  background-color: #CAE3F2;
+  padding: 4px;
+  border: 1px solid #4B9FD5;
+}
+
 /* ------------------- SETUP / MIGRATION PAGES ------------------- */
 .migration {
   background-image: url("../images/sonar.png");
@@ -316,7 +322,7 @@ h4, .h4 {
   border: 1px solid #4b9fd5;
   width: 230px;
   text-align: left;
-  background-color: #d4e7ff;
+  background-color: #CAE3F2;
   padding: 15px 20px;
 }
 
@@ -2347,27 +2353,35 @@ select.medium-width {
   background-color: #EFEFEF;
   line-height: 30px;
   height: 30px;
+  border-bottom: 1px solid #ccc;
 }
 
 .form-body {
-  border-top: 1px solid #ccc;
+  padding: 5px;
 }
 
 .form-field {
-  padding: 5px 10px;
+  clear: both;
+  display: block;
+  padding: 5px 0 5px 140px;
 }
 
-.form-field label:before {
-  content: "";
+.form-field label em {
+  color: #990000;
+  font-style: italic;
 }
 
 .form-field label {
   display: block;
-  text-align: right;
-  width: 120px;
   float: left;
+  text-align: right;
+  width: 130px;
+  left: -140px;
+  margin-right: -130px;
   line-height: 1;
-  padding: 5px 5px 0 0;
+  word-wrap: break-word;
+  position: relative;
+  padding-top: 5px;
 }
 
 .form-foot {
@@ -2382,6 +2396,12 @@ select.medium-width {
   margin-right: 10px;
 }
 
+.form-field-description {
+  clear: both;
+  font-size: 11px;
+  color: #777;
+}
+
 input[type=text], input[type=password]{
   height: 18px;
   padding: 0 3px;