Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2016-09-18 02:48:41 +0300
committerSteffen van Bergerem <svbergerem@omgsrsly.net>2016-09-28 22:59:08 +0300
commit07a4925f3b75b3561c9791ae68d424b3b87fe350 (patch)
treeb724423d20835017537b25eb46f2cad8baf60de8 /app/views
parent20cdbe262e7c7bd56989ffc9decc87f63738d6e9 (diff)
Extract tags autocompletion JS to file
Diffstat (limited to 'app/views')
-rw-r--r--app/views/profiles/_edit_public.haml30
-rw-r--r--app/views/profiles/edit.mobile.haml6
-rw-r--r--app/views/users/getting_started.mobile.haml26
3 files changed, 7 insertions, 55 deletions
diff --git a/app/views/profiles/_edit_public.haml b/app/views/profiles/_edit_public.haml
index 74411cae7..c03c1b23f 100644
--- a/app/views/profiles/_edit_public.haml
+++ b/app/views/profiles/_edit_public.haml
@@ -1,33 +1,3 @@
-- content_for :head do
- :javascript
- $(document).ready(function () {
- var data = $.parseJSON( '#{@tags_array.to_json.gsub("'", "\\\\'")}' ),
- autocompleteInput = $("#profile_tag_string");
-
- autocompleteInput.autoSuggest("#{tags_path}", {
- selectedItemProp: "name",
- selectedValuesProp: "name",
- searchObjProps: "name",
- asHtmlID: "tags",
- neverSubmit: true,
- retrieveLimit: 10,
- minChars: 2,
- keyDelay: 200,
- startText: "",
- emptyText: "#{t('no_results')}",
- preFill: data
- });
-
- autocompleteInput.bind('keydown', function(evt){
- if(evt.which === Keycodes.ENTER || evt.which === Keycodes.TAB || evt.which === Keycodes.SPACE) {
- evt.preventDefault();
- if( $('li.as-result-item.active').length == 0 ){
- $('li.as-result-item').first().click();
- }
- }
- });
- });
-
%h3.inline
= t("profiles.edit.basic")
%span{ :title => t("profiles.edit.basic_hint") }
diff --git a/app/views/profiles/edit.mobile.haml b/app/views/profiles/edit.mobile.haml
index 608b9a8c0..98aa81533 100644
--- a/app/views/profiles/edit.mobile.haml
+++ b/app/views/profiles/edit.mobile.haml
@@ -2,6 +2,12 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
+- content_for :head do
+ :javascript
+ $(document).ready(function () {
+ new Diaspora.TagsAutocomplete("#profile_tag_string", {preFill: gon.preloads.tagsArray});
+ });
+
.settings_container.container-fluid
.row
.col-md-12
diff --git a/app/views/users/getting_started.mobile.haml b/app/views/users/getting_started.mobile.haml
index ff158e90a..65c56a70a 100644
--- a/app/views/users/getting_started.mobile.haml
+++ b/app/views/users/getting_started.mobile.haml
@@ -5,31 +5,7 @@
- content_for :head do
:javascript
$(document).ready(function () {
- var data = $.parseJSON( '#{@tags_array.to_json.gsub("'", "\\\\'")}' ),
- autocompleteInput = $("#follow_tags");
-
- autocompleteInput.autoSuggest("#{tags_path}", {
- selectedItemProp: "name",
- selectedValuesProp: "name",
- searchObjProps: "name",
- asHtmlID: "tags",
- neverSubmit: true,
- retrieveLimit: 10,
- minChars: 2,
- keyDelay: 200,
- startText: "",
- emptyText: "#{t('no_results')}",
- preFill: data
- });
-
- autocompleteInput.bind('keydown', function(evt){
- if(evt.which === Keycodes.ENTER || evt.which === Keycodes.TAB || evt.which === Keycodes.SPACE) {
- evt.preventDefault();
- if( $('li.as-result-item.active').length == 0 ){
- $('li.as-result-item').first().click();
- }
- }
- });
+ new Diaspora.TagsAutocomplete("#follow_tags");
});
:css