OSDN Git Service

Fix form label for ssl requests
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 22 Mar 2012 18:02:38 +0000 (20:02 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 22 Mar 2012 18:02:38 +0000 (20:02 +0200)
app/helpers/application_helper.rb
app/views/admin/projects/_form.html.haml
app/views/projects/_form.html.haml

index 4d85e39..a69a1a0 100644 (file)
@@ -11,6 +11,14 @@ module ApplicationHelper
     true
   end
 
+  def request_protocol
+    request.ssl? ? "https" : "http"
+  end
+
+  def web_app_url
+    "#{request_protocol}://#{GIT_HOST["host"]}/"
+  end
+
   def body_class(default_class = nil)
     main = content_for(:body_class).blank? ?
       default_class :
index 8e16437..84cd030 100644 (file)
@@ -20,7 +20,7 @@
       Code
     .input
       .input-prepend
-        %span.add-on= "http://#{GIT_HOST["host"]}/"
+        %span.add-on= web_app_url
         = f.text_field :code, :placeholder => "example"
 
   - unless @admin_project.new_record?
index 9c39f80..5d22f11 100644 (file)
@@ -19,7 +19,7 @@
       Code
     .input
       .input-prepend
-        %span.add-on= "http://#{GIT_HOST["host"]}/"
+        %span.add-on= web_app_url
         = f.text_field :code, :placeholder => "example"
 
   - unless @project.new_record? || @project.heads.empty?