Commit c7cfe3d83bfbad2a074cacb5a4ed8a24244f8f26

Authored by Dmitriy Zaporozhets
1 parent 0c5e5569

devise session templates to haml. Fix problem with missing message in commit

app/decorators/commit_decorator.rb
... ... @@ -16,6 +16,8 @@ class CommitDecorator < ApplicationDecorator
16 16 # In case this first line is longer than 80 characters, it is cut off
17 17 # after 70 characters and ellipses (`&hellp;`) are appended.
18 18 def title
  19 + return no_commit_message unless safe_message
  20 +
19 21 title_end = safe_message.index(/\n/)
20 22 if (!title_end && safe_message.length > 80) || (title_end && title_end > 80)
21 23 safe_message[0..69] << "&hellip;".html_safe
... ... @@ -35,4 +37,10 @@ class CommitDecorator &lt; ApplicationDecorator
35 37 safe_message.split(/\n/, 2)[1].try(:chomp)
36 38 end
37 39 end
  40 +
  41 + protected
  42 +
  43 + def no_commit_message
  44 + "--no commit message"
  45 + end
38 46 end
... ...
app/views/devise/sessions/_new_ldap.html.erb
... ... @@ -1,39 +0,0 @@
1   -<%= form_tag(user_omniauth_callback_path(:ldap), :class => "login-box", :id => 'new_ldap_user' ) do %>
2   - <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %>
3   -
4   - <%= text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login"} %>
5   - <%= password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"} %>
6   -
7   - <br/>
8   - <%= submit_tag "LDAP Sign in", :class => "primary btn" %>
9   -
10   - <%- if devise_mapping.omniauthable? %>
11   - <%- (resource_class.omniauth_providers - [:ldap]).each do |provider| %>
12   - <hr/>
13   - <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %><br />
14   - <% end -%>
15   - <% end -%>
16   -
17   - <hr/>
18   - <a href="#" id="other_form_toggle" onclick="javascript:$('#new_user').toggle();">Other Sign in</a>
19   - <!-- inline for right now just to illustrate -->
20   - <script type="text/javascript">
21   - $(function() {
22   - $('#new_user').toggle();
23   - });
24   - </script>
25   -<% end %>
26   -
27   -
28   -<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %>
29   - <%= f.text_field :email, :class => "text top", :placeholder => "Email" %>
30   - <%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %>
31   -
32   - <% if devise_mapping.rememberable? -%>
33   - <div class="clearfix inputs-list"> <label class="checkbox remember_me" for="user_remember_me"><%= f.check_box :remember_me %><span>Remember me</span></label></div>
34   - <% end -%>
35   - <br/>
36   - <%= f.submit "Sign in", :class => "primary btn" %>
37   - <div class="right"> <%= render :partial => "devise/shared/links" %></div>
38   -
39   -<% end %>
app/views/devise/sessions/_new_ldap.html.haml 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 += form_tag(user_omniauth_callback_path(:ldap), :class => "login-box", :id => 'new_ldap_user' ) do
  2 + = image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo"
  3 + = text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login"}
  4 + = password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"}
  5 + %br/
  6 + = submit_tag "LDAP Sign in", :class => "primary btn"
  7 + - if devise_mapping.omniauthable?
  8 + - (resource_class.omniauth_providers - [:ldap]).each do |provider|
  9 + %hr/
  10 + = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary"
  11 + %br/
  12 + %hr/
  13 + %a#other_form_toggle{:href => "#", :onclick => "javascript:$('#new_user').toggle();"} Other Sign in
  14 + :javascript
  15 + $(function() {
  16 + $('#new_user').toggle();
  17 + });
  18 + = form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f|
  19 + = f.text_field :email, :class => "text top", :placeholder => "Email"
  20 + = f.password_field :password, :class => "text bottom", :placeholder => "Password"
  21 + - if devise_mapping.rememberable?
  22 + .clearfix.inputs-list
  23 + %label.checkbox.remember_me{:for => "user_remember_me"}
  24 + = f.check_box :remember_me
  25 + %span Remember me
  26 + %br/
  27 + = f.submit "Sign in", :class => "primary btn"
  28 + .right
  29 + = render :partial => "devise/shared/links"
... ...
app/views/devise/sessions/new.html.erb
... ... @@ -1,27 +0,0 @@
1   -<% unless ldap_enable? -%>
2   -
3   - <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %>
4   - <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %>
5   -
6   - <%= f.text_field :email, :class => "text top", :placeholder => "Email" %>
7   - <%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %>
8   -
9   - <% if devise_mapping.rememberable? -%>
10   - <div class="clearfix inputs-list"> <label class="checkbox remember_me" for="user_remember_me"><%= f.check_box :remember_me %><span>Remember me</span></label></div>
11   - <% end -%>
12   - <br/>
13   - <%= f.submit "Sign in", :class => "primary btn" %>
14   - <div class="right"> <%= render :partial => "devise/shared/links" %></div>
15   -
16   - <%- if devise_mapping.omniauthable? %>
17   - <%- resource_class.omniauth_providers.each do |provider| %>
18   - <hr/>
19   - <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %><br />
20   - <% end -%>
21   - <% end -%>
22   -
23   - <% end %>
24   -
25   -<% else %>
26   - <%= render :partial => 'devise/sessions/new_ldap' %>
27   -<% end %>
app/views/devise/sessions/new.html.haml 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +- if ldap_enable?
  2 + = render :partial => 'devise/sessions/new_ldap'
  3 +- else
  4 + = form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f|
  5 + = image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo"
  6 + = f.text_field :email, :class => "text top", :placeholder => "Email"
  7 + = f.password_field :password, :class => "text bottom", :placeholder => "Password"
  8 + - if devise_mapping.rememberable?
  9 + .clearfix.inputs-list
  10 + %label.checkbox.remember_me{:for => "user_remember_me"}
  11 + = f.check_box :remember_me
  12 + %span Remember me
  13 + %br/
  14 + = f.submit "Sign in", :class => "primary btn wide"
  15 + .right
  16 + = render :partial => "devise/shared/links"
  17 + - if devise_mapping.omniauthable?
  18 + - resource_class.omniauth_providers.each do |provider|
  19 + %hr/
  20 + = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary"
  21 + %br/
... ...