Project

General

Profile

Feature #24089 » 0003-Adds-registration-CTA-links-to-relevant-places.patch

Jan from Planio www.plan.io, 2016-10-17 17:20

View differences:

app/helpers/application_helper.rb
1268 1268
    content_for?(:sidebar) || view_layouts_base_sidebar_hook_response.present?
1269 1269
  end
1270 1270

  
1271
  def show_registration_cta?(action=nil, context=nil, options={})
1272
    return false if User.current.logged? or !Setting.self_registration? or !Setting.enable_registration_cta?
1273
    return true  if action.blank? and context.blank? and options.blank?
1274
    return User.new.allowed_to?(action, context, options)
1275
  end
1276

  
1271 1277
  def view_layouts_base_sidebar_hook_response
1272 1278
    @view_layouts_base_sidebar_hook_response ||= call_hook(:view_layouts_base_sidebar)
1273 1279
  end
app/views/account/login.html.erb
24 24
  
25 25
  <input type="submit" name="login" value="<%=l(:button_login)%>" tabindex="5" id="login-submit" />
26 26
  <% end %>
27

  
28
  <% if show_registration_cta? %>
29
    <p class="registration-cta"><%= l(:text_no_account_question)%> <%= link_to l(:label_register), :register %></p>
30
  <% end %>
27 31
</div>
28 32

  
29 33
<%= call_hook :view_account_login_bottom %>
app/views/issues/index.html.erb
1 1
<div class="contextual">
2
  <% if User.current.allowed_to?(:add_issues, @project, :global => true) && (@project.nil? || Issue.allowed_target_trackers(@project).any?) %>
2
  <% if allowed_to_add_issues = (User.current.allowed_to?(:add_issues, @project, :global => true) && (@project.nil? || Issue.allowed_target_trackers(@project).any?)) %>
3 3
    <%= link_to l(:label_issue_new), _new_project_issue_path(@project), :class => 'icon icon-add new-issue' %>
4 4
  <% end %>
5 5
</div>
......
53 53
<% end %>
54 54
<%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %>
55 55

  
56
<% if !allowed_to_add_issues && show_registration_cta?(:add_issues, @project, :global => true) %>
57
  <p class="registration-cta"><%= t :label_register_to_add_issue_html, register_to: link_to(l(:label_register_to), register_path) %></p>
58
<% end %>
59

  
56 60
<% content_for :sidebar do %>
57 61
    <%= render :partial => 'issues/sidebar' %>
58 62
<% end %>
app/views/issues/show.html.erb
123 123
</div>
124 124
<% end %>
125 125

  
126
<% if !@issue.editable? && show_registration_cta? &&
127
      (User.new.allowed_to?(:edit_issues, @project) || User.new.allowed_to?(:add_issue_notes, @project)) %>
128

  
129
  <p class="registration-cta"><%= t :label_register_to_edit_issue_html, register_to: link_to(l(:label_register_to), register_path) %></p>
130
<% end %>
126 131

  
127 132
<div style="clear: both;"></div>
128 133
<%= render :partial => 'action_menu' %>
app/views/messages/show.html.erb
35 35

  
36 36
<% unless @replies.empty? %>
37 37
<h3 class="comments"><%= l(:label_reply_plural) %> (<%= @reply_count %>)</h3>
38
<% if !@topic.locked? && authorize_for('messages', 'reply') && @replies.size >= 3 %>
38
<% if @replies.size >= 3 %>
39
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
39 40
  <p><%= toggle_link l(:button_reply), "reply", :focus => 'message_content', :scroll => "message_content" %></p>
41
<% elsif show_registration_cta? :add_messages, @project %>
42
  <p class="registration-cta"><%= t :label_register_to_add_message_html, register_to: link_to(l(:label_register_to), register_path) %></p>
43
<% end %>
40 44
<% end %>
41 45
<% @replies.each do |message| %>
42 46
  <div class="message reply" id="<%= "message-#{message.id}" %>">
......
87 91
<% end %>
88 92
<div id="preview" class="wiki"></div>
89 93
</div>
94
<% elsif show_registration_cta? :add_messages, @project %>
95
  <p class="registration-cta"><%= t :label_register_to_add_message_html, register_to: link_to(l(:label_register_to), register_path) %></p>
90 96
<% end %>
91 97

  
92 98
<% html_title @topic.subject %>
app/views/news/show.html.erb
33 33

  
34 34
<div id="comments" style="margin-bottom:16px;">
35 35
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
36
<% if @news.commentable? && @comments.size >= 3 %>
36
<% if @comments.size >= 3 %>
37
<% if @news.commentable? %>
37 38
  <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments", :scroll => "comment_comments" %></p>
39
<% elsif show_registration_cta? :comment_news, @project %>
40
  <p class="registration-cta"><%= t :label_register_to_comment_html, register_to: link_to(l(:label_register_to), register_path) %></p>
41
<% end %>
38 42
<% end %>
39 43
<% @comments.each do |comment| %>
40 44
    <% next if comment.new_record? %>
......
60 64
</div>
61 65
<p><%= submit_tag l(:button_add) %></p>
62 66
<% end %>
67
<% elsif show_registration_cta? :comment_news, @project %>
68
  <p class="registration-cta"><%= t :label_register_to_comment_html, register_to: link_to(l(:label_register_to), register_path) %></p>
63 69
<% end %>
64 70

  
65 71
<% html_title @news.title -%>
app/views/settings/_authentication.html.erb
10 10
                                           [l(:label_registration_manual_activation), "2"],
11 11
                                           [l(:label_registration_automatic_activation), "3"]],
12 12
                      :onchange =>
13
                          "if (this.value != '0') { $('#settings_show_custom_fields_on_registration').removeAttr('disabled'); } else { $('#settings_show_custom_fields_on_registration').attr('disabled', true); }" %></p>
13
                          "if (this.value != '0') { $('#settings_enable_registration_cta, #settings_show_custom_fields_on_registration').removeAttr('disabled'); } else { $('#settings_enable_registration_cta, #settings_show_custom_fields_on_registration').attr('disabled', true); }" %></p>
14

  
15
<p>
16
  <%= setting_check_box :enable_registration_cta,
17
                        :disabled => !Setting.self_registration? %>
18
  <em class="info"><%= l(:text_enable_registration_cta) %></em>
19
</p>
14 20

  
15 21
<p><%= setting_check_box :show_custom_fields_on_registration,
16 22
                         :disabled => !Setting.self_registration? %></p>
config/locales/de.yml
697 697
  label_read: Lesen...
698 698
  label_readonly: Nur-Lese-Zugriff
699 699
  label_register: Registrieren
700
  label_register_to: registrieren Sie sich
701
  label_register_to_comment_html: Bitte %{register_to}, um einen Kommentar hinzuzufügen
702
  label_register_to_add_message_html: Bitte %{register_to}, um zu antworten
703
  label_register_to_edit_issue_html: Bitte %{register_to}, um das Ticket zu bearbeiten
704
  label_register_to_add_issue_html: Bitte %{register_to}, um ein Ticket hinzuzufügen
700 705
  label_registered_on: Angemeldet am
701 706
  label_registration_activation_by_email: Kontoaktivierung durch E-Mail
702 707
  label_registration_automatic_activation: Automatische Kontoaktivierung
......
1039 1044
  setting_rest_api_enabled: REST-Schnittstelle aktivieren
1040 1045
  setting_self_registration: Registrierung ermöglichen
1041 1046
  setting_show_custom_fields_on_registration: Benutzerdefinierte Felder bei der Registrierung abfragen
1047
  setting_enable_registration_cta: Aktiviere Registerungsaufforderungen
1042 1048
  setting_sequential_project_identifiers: Fortlaufende Projektkennungen generieren
1043 1049
  setting_session_lifetime: Längste Dauer einer Sitzung
1044 1050
  setting_session_timeout: Zeitüberschreitung bei Inaktivität
......
1062 1068
  text_assign_time_entries_to_project: Gebuchte Aufwände dem Projekt zuweisen
1063 1069
  text_caracters_maximum: "Max. %{count} Zeichen."
1064 1070
  text_caracters_minimum: "Muss mindestens %{count} Zeichen lang sein."
1071
  text_enable_registration_cta: Zeigt Links zum Registrierungsformular wo möglich
1072
  text_no_account_question: Noch kein Benutzerkonto?
1065 1073
  text_comma_separated: Mehrere Werte erlaubt (durch Komma getrennt).
1066 1074
  text_convert_available: ImageMagick-Konvertierung verfügbar (optional)
1067 1075
  text_custom_field_possible_values_info: 'Eine Zeile pro Wert'
config/locales/en.yml
372 372
  setting_default_language: Default language
373 373
  setting_login_required: Authentication required
374 374
  setting_self_registration: Self-registration
375
  setting_enable_registration_cta: Enable registration call to action
375 376
  setting_show_custom_fields_on_registration: Show custom fields on registration
376 377
  setting_attachment_max_size: Maximum attachment size
377 378
  setting_issues_export_limit: Issues export limit
......
583 584
  label_information_plural: Information
584 585
  label_please_login: Please log in
585 586
  label_register: Register
587
  label_register_to: register
588
  label_register_to_comment_html: Please %{register_to} to add a comment
589
  label_register_to_add_message_html: Please %{register_to} to reply
590
  label_register_to_edit_issue_html: Please %{register_to} to edit this issue
591
  label_register_to_add_issue_html: Please %{register_to} to add an issue
586 592
  label_login_with_open_id_option: or login with OpenID
587 593
  label_password_lost: Lost password
588 594
  label_password_required: Confirm your password to continue
......
1094 1100
  text_length_between: "Length between %{min} and %{max} characters."
1095 1101
  text_tracker_no_workflow: No workflow defined for this tracker
1096 1102
  text_unallowed_characters: Unallowed characters
1103
  text_enable_registration_cta: Show links to registration form where possible
1104
  text_no_account_question: No account yet?
1097 1105
  text_comma_separated: Multiple values allowed (comma separated).
1098 1106
  text_line_separated: Multiple values allowed (one line for each value).
1099 1107
  text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
config/settings.yml
31 31
self_registration:
32 32
  default: '2'
33 33
  security_notifications: 1
34
enable_registration_cta:
35
  default: 0
34 36
show_custom_fields_on_registration:
35 37
  default: 1
36 38
lost_password:
public/stylesheets/application.css
714 714
.other-formats span + span:before { content: "| "; }
715 715

  
716 716
a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px 3px 16px; }
717
p.registration-cta { background: url(../images/user.png) no-repeat 1px 50%; padding: 2px 0px 3px 20px; }
717 718

  
718 719
em.info {font-style:normal;font-size:90%;color:#888;display:block;}
719 720
em.info.error {padding-left:20px; background:url(../images/exclamation.png) no-repeat 0 50%;}
(3-3/8)