diff --git a/app/assets/javascripts/app/views/help_view.js b/app/assets/javascripts/app/views/help_view.js index ffd773b20d5965afaba5b52ac99e08556c4519a7..168715e556a58ab59d66e3c175fc7e736e9b4f50 100644 --- a/app/assets/javascripts/app/views/help_view.js +++ b/app/assets/javascripts/app/views/help_view.js @@ -9,7 +9,8 @@ app.views.Help = app.views.StaticContentView.extend({ "click .faq-link-sharing" : "sharing", "click .faq-link-posts-and-posting" : "postsAndPosting", "click .faq-link-tags": "tags", - "click .faq-link-keyboard-shortcuts" : "keyboardShortcuts" + "click .faq-link-keyboard-shortcuts" : "keyboardShortcuts", + "click .faq-link-chat" : "chat" }, initialize : function() { @@ -35,6 +36,13 @@ app.views.Help = app.views.StaticContentView.extend({ } }; + this.CHAT_SUBS = { + add_contact_roster_a: { + toggle_privilege: this.getChatIcons(), + contacts_page: this.linkHtml(Routes.contacts_path(), Diaspora.I18n.t('chat.contacts_page')) + } + }; + this.data = { title_header: Diaspora.I18n.t( 'title_header' ), title_getting_help: Diaspora.I18n.t( 'getting_help.title' ), @@ -51,7 +59,9 @@ app.views.Help = app.views.StaticContentView.extend({ title_sharing: Diaspora.I18n.t( 'sharing.title' ), title_tags: Diaspora.I18n.t( 'tags.title' ), title_keyboard_shortcuts: Diaspora.I18n.t( 'keyboard_shortcuts.title' ), - title_miscellaneous: Diaspora.I18n.t( 'miscellaneous.title' ) + title_miscellaneous: Diaspora.I18n.t( 'miscellaneous.title' ), + title_chat: Diaspora.I18n.t( 'chat.title' ), + chat_enabled: this.chatEnabled() }; return this; @@ -143,7 +153,7 @@ app.views.Help = app.views.StaticContentView.extend({ /** * Returns The section title whose data-section property equals the given query * Returns null if nothing found - * @param dataValue Value for the data-section to find + * @param data Value for the data-section to find * @returns {jQuery} */ findSection: function(data){ @@ -187,8 +197,27 @@ app.views.Help = app.views.StaticContentView.extend({ e.preventDefault(); }, + chat: function(e){ + this.renderStaticSection("chat", "faq_chat", this.CHAT_SUBS); + this.menuClicked(e); + + e.preventDefault(); + }, + linkHtml: function(url, text) { return "<a href=\"" + url + "\" target=\"_blank\">" + text + "</a>"; + }, + + chatEnabled: function(){ + return gon.chatEnabled; + }, + + getChatIcons: function(){ + return '<div class="help-chat-icons">' + + ' <i class="entypo lock-open"></i>' + + ' <i class="entypo chat"></i>' + + ' <i class="entypo trash"></i>' + + '</div>'; } }); // @license-end diff --git a/app/assets/stylesheets/help.css.scss b/app/assets/stylesheets/help.css.scss index f6075d6791ee6527b8efda5791efa6fb70f6d167..56fde842eb499a6fc84d772598e42213df6adfea 100644 --- a/app/assets/stylesheets/help.css.scss +++ b/app/assets/stylesheets/help.css.scss @@ -91,6 +91,18 @@ ul#help_nav { border-radius: 0px 0px 4px 4px; background-color: white; padding: 10px 20px; + + div.help-chat-icons{ + text-align: center; + font-size: 50px; + line-height: 70px; + + i.entypo{ + color: #bfbfbf; + + &.chat{ color: #000000; } + } + } } } } diff --git a/app/assets/templates/faq_chat_tpl.jst.hbs b/app/assets/templates/faq_chat_tpl.jst.hbs new file mode 100644 index 0000000000000000000000000000000000000000..fb3633345c156638b9b64e047f7dd8a35485f428 --- /dev/null +++ b/app/assets/templates/faq_chat_tpl.jst.hbs @@ -0,0 +1,6 @@ +<div class='question opened collapsible'> + <a class='toggle' href='#'> + <h4>{{ add_contact_roster_q }}</h4> + </a> + <div class='answer hideable'>{{{ add_contact_roster_a }}}</div> +</div> \ No newline at end of file diff --git a/app/assets/templates/help_tpl.jst.hbs b/app/assets/templates/help_tpl.jst.hbs index 22c198186fb8772f9ac886a2d33965e7fd019ab6..f8f01e7ac74d0e821af28a4e5c11e582cd4e715f 100644 --- a/app/assets/templates/help_tpl.jst.hbs +++ b/app/assets/templates/help_tpl.jst.hbs @@ -68,6 +68,12 @@ <a href="#" class="section-unselected faq-link" data-section="miscellaneous" data-items="back_to_top photo_albums subscribe_feed diaspora_app">{{ title_miscellaneous }}</a> <span class="section-selected">{{ title_miscellaneous }}</span> </li> + {{#if chat_enabled }} + <li> + <a href="#" class="section-unselected faq-link-chat" data-section="chat" data-items="add_contact_roster i_m_a_podmin">{{ title_chat }}</a> + <span class="section-selected">{{ title_chat }}</span> + </li> + {{/if}} </ul> </div> </div> diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 0e3e05f6e64e8dd6d7772836315b553b8a8a27f8..8d39d3b4a27977ae7b7f7ec2d94799df6c48c882 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -1,4 +1,8 @@ class HelpController < ApplicationController - before_filter -> { @css_framework = :bootstrap } - layout ->(c) { request.format == :mobile ? "application" : "with_header_with_footer" } -end + before_filter -> { @css_framework = :bootstrap } + layout -> (c) { request.format == :mobile ? "application" : "with_header_with_footer" } + + def faq + gon.chatEnabled = AppConfig.chat.enabled? + end +end \ No newline at end of file diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 04d3c2965131c9f08d037191a7da1b45092928f6..b137d13a3ea3dd4f416f893c643cb3700c3ac5a1 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -449,6 +449,11 @@ en: person_multiple_aspects_a: "Yes. Go to your contacts page and click on “My contactsâ€. For each contact you can use the menu on the right to add them to (or remove them from) as many aspects as you want. Or you can add them to a new aspect (or remove them from an aspect) by clicking the aspect selector button on their profile page. Or you can even just move the pointer over their name where you see it in the stream, and a “hover-card†will appear. You can change the aspects they are in right there." delete_aspect_q: "How do I delete an aspect?" delete_aspect_a: "In your list of aspects on the left side of the main page, point your mouse at the aspect you want to delete. Click the little “Edit†pencil that appears on the right. Click the “Delete this aspect†button in the box that appears." + chat: + title: "Chat" + contacts_page: "contacts page" + add_contact_roster_q: "How do I chat with someone in diaspora*?" + add_contact_roster_a: "First, you need to enable chat for one of the aspects that person is in. To do so, go to the %{contacts_page}, select the aspect you want and click on the chat icon to enable chat for the aspect. %{toggle_privilege} You could, if you prefer, create a special aspect called 'Chat' and add the people you want to chat with to that aspect. Once you've done this, open the chat interface and select the person you want to chat with." mentions: title: "Mentions" what_is_a_mention_q: "What is a \"mention\"?" diff --git a/spec/javascripts/app/views/help_view_spec.js b/spec/javascripts/app/views/help_view_spec.js index c19567d25d91b6483be40f595afbbed6dcd9d08e..7a2555a3f2c23729e85fa91b8021de4906fbb8e4 100644 --- a/spec/javascripts/app/views/help_view_spec.js +++ b/spec/javascripts/app/views/help_view_spec.js @@ -134,4 +134,30 @@ describe("app.views.Help", function(){ }); }); }); + + describe("chat section", function(){ + describe("chat enabled", function(){ + beforeEach(function(){ + gon.chatEnabled = true; + this.view = new app.views.Help(); + this.view.render(); + }); + + it('should display the chat', function(){ + expect(this.view.$el.find('a[data-section=chat]').length).toBe(1); + }); + }); + + describe("chat disabled", function(){ + beforeEach(function(){ + gon.chatEnabled = false; + this.view = new app.views.Help(); + this.view.render(); + }); + + it('should not display the chat', function () { + expect(this.view.$el.find('a[data-section=chat]').length).toBe(0); + }); + }); + }); });