Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added autosuggest support for tags with news form_static control tags

  • Loading branch information...
commit c8bcfeb70f293106cde00921ccbaf54b7a988427 1 parent f73ab65
@amitamb authored
Showing with 618 additions and 14 deletions.
  1. +129 −0 app/assets/javascripts/application.js
  2. +1 −0  app/assets/javascripts/base.js
  3. +390 −0 app/assets/javascripts/jquery.autocomplete.js
  4. +2 −0  app/assets/stylesheets/base.css
  5. +5 −0 app/assets/stylesheets/jquery.autocomplete.css
  6. +49 −0 app/assets/stylesheets/tags_input.css
  7. +7 −0 app/controllers/tags_controller.rb
  8. 0  app/inputs/_tags_input.html.erb
  9. +19 −0 app/inputs/tags_input.rb
  10. +1 −1  app/views/articles/_article_form.html.haml
  11. +1 −1  app/views/articles/edit.html.haml
  12. +1 −1  app/views/articles/new.html.haml
  13. +1 −1  app/views/events/new.html.haml
  14. +1 −1  app/views/galleries/new.html.haml
  15. +1 −1  app/views/ideas/new.html.haml
  16. +1 −1  app/views/prediction_groups/new.html.haml
  17. +1 −1  app/views/prediction_questions/new.html.haml
  18. +1 −1  app/views/questions/index.html.haml
  19. +1 −1  app/views/questions/new.html.haml
  20. +1 −1  app/views/resources/new.html.haml
  21. +1 −1  app/views/stories/_story_form.html.haml
  22. +1 −1  app/views/stories/new.html.haml
  23. +1 −1  app/views/topics/_topic_form.html.haml
  24. +2 −0  config/routes/main.rb
View
129 app/assets/javascripts/application.js
@@ -682,3 +682,132 @@ function shareEventHandler(event) {
}
}
addthis.addEventListener('addthis.menu.share',shareEventHandler);
+
+(function($){
+ $("ul.tags_input").each(function(){
+
+ var $e = $(this);
+ var $hidden_input = $e.prev("input");
+
+ function getTagHtml(t){
+ var $li = $("<li class='tag'><span class='txt'></span><img src='/assets/site/btn-close.gif' /><span style='clear:both;'></span></li>");
+ $li.find("span.txt").text(t);
+ return $li;
+ }
+
+ function getTagsList(){
+ var tags_str = $hidden_input.val();
+ if ( tags_str.length == 0 ) { return []; }
+ var tags = tags_str.split(",");
+ return tags;
+ }
+
+ function setTagsList(tags){
+ $hidden_input.val(tags.join(","));
+ }
+
+ function addTagUI(tag_str){
+ $e.find("li.tag_input").before(getTagHtml(tag_str));
+ }
+
+ function removeTagUI($tag_li){
+ $tag_li.remove();
+ }
+
+ function addTag(tag_str){
+ tag_str = $.trim( tag_str );
+ if (tag_str=="") {
+ return;
+ }
+ var tags = getTagsList();
+ var found = false;
+ var tag_str_l = tag_str.toLowerCase();
+ for (var i=0,len=tags.length;i<len;i++) {
+ var t = tags[i];
+ if ( t.toLowerCase() == tag_str_l ) {
+ found = true;
+ break;
+ }
+ }
+ if (!found){
+ tags.push(tag_str);
+ setTagsList(tags);
+ addTagUI(tag_str);
+ autocomplete.fixPosition();
+ }
+ }
+
+ function removeTag($tag_elem){
+ var tag_str = $tag_elem.find("span.txt").text();
+ var tags = getTagsList();
+ for (var i=0,len=tags.length;i<len;i++) {
+ var t = tags[i];
+ if ( t == tag_str ) {
+ tags.splice(i, 1)
+ break;
+ }
+ }
+ setTagsList(tags);
+ removeTagUI($tag_elem);
+ autocomplete.fixPosition();
+ }
+
+ var tags = getTagsList();
+
+ for ( var i = 0, len = tags.length; i < len ; i++ ) {
+ var t = tags[i];
+ addTagUI(t);
+ }
+
+ $e.append("<li class='tag_input'><input type='text' /></li>");
+ $e.append("<div style='clear:both;'></div>");
+ $e.click(function(e){
+ if ( $(e.target).is("ul") ) {
+ $(this).find("li>input").focus();
+ }
+ });
+ $e.delegate("li.tag>img", "click", function(){
+ var $this = $(this);
+ removeTag($this.parents("li.tag"));
+ });
+ $e.find("li>input").keydown(function(e){
+ var $this = $(this);
+ if ( ( e.which == 9 && $this.val() != "" ) || e.which == 188 || e.which == 186 || e.which == 13) {
+ var t= $this.val();
+ addTag(t);
+ $this.val("");
+ return false;
+ } else if ( e.which == 8 && $this.val() == "" ) { // backspace
+ document.title = "Backspace";
+ var $last_li_tag = $e.find("li.tag:last");
+ if ( $last_li_tag.length > 0 ) {
+ removeTag($last_li_tag);
+ }
+ }
+ });
+ $e.find("li>input").focusout(function(e){
+ var $this = $(this);
+ if ( $this.val() ) {
+ var t= $this.val();
+ addTag(t);
+ $this.val("");
+ }
+ });
+
+ var autocomplete = $e.find("li>input").autocomplete({
+ // callback function:
+ onSelect: function(value, data){
+ $this = $e.find("li>input");
+ var t= $this.val();
+ addTag(t);
+ $this.val("");
+ $this.focus();
+ return false;
+ },
+ serviceUrl:'/tags/suggest',
+ deferRequestBy: 100, //miliseconds
+ //lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values
+ });
+
+ });
+})(jQuery);
View
1  app/assets/javascripts/base.js
@@ -12,3 +12,4 @@
//= require jquery.timeago
//= require jquery-ui-1.8.5.custom.effects.min
//= require jquery.prettyPhoto
+//= require jquery.autocomplete
View
390 app/assets/javascripts/jquery.autocomplete.js
@@ -0,0 +1,390 @@
+/**
+* Ajax Autocomplete for jQuery, version 1.1.3
+* (c) 2010 Tomas Kirda
+*
+* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
+* For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/
+*
+* Last Review: 04/19/2010
+*/
+
+/*jslint onevar: true, evil: true, nomen: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
+/*global window: true, document: true, clearInterval: true, setInterval: true, jQuery: true */
+
+(function($) {
+
+ var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g');
+
+ function fnFormatResult(value, data, currentValue) {
+ var pattern = '(' + currentValue.replace(reEscape, '\\$1') + ')';
+ return value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
+ }
+
+ function Autocomplete(el, options) {
+ this.el = $(el);
+ this.el.attr('autocomplete', 'off');
+ this.suggestions = [];
+ this.data = [];
+ this.badQueries = [];
+ this.selectedIndex = -1;
+ this.currentValue = this.el.val();
+ this.intervalId = 0;
+ this.cachedResponse = [];
+ this.onChangeInterval = null;
+ this.ignoreValueChange = false;
+ this.serviceUrl = options.serviceUrl;
+ this.isLocal = false;
+ this.options = {
+ autoSubmit: false,
+ minChars: 1,
+ maxHeight: 300,
+ deferRequestBy: 0,
+ width: 0,
+ highlight: true,
+ params: {},
+ fnFormatResult: fnFormatResult,
+ delimiter: null,
+ zIndex: 9999
+ };
+ this.initialize();
+ this.setOptions(options);
+ }
+
+ $.fn.autocomplete = function(options) {
+ return new Autocomplete(this.get(0)||$('<input />'), options);
+ };
+
+
+ Autocomplete.prototype = {
+
+ killerFn: null,
+
+ initialize: function() {
+
+ var me, uid, autocompleteElId;
+ me = this;
+ uid = Math.floor(Math.random()*0x100000).toString(16);
+ autocompleteElId = 'Autocomplete_' + uid;
+
+ this.killerFn = function(e) {
+ if ($(e.target).parents('.autocomplete').size() === 0) {
+ me.killSuggestions();
+ me.disableKillerFn();
+ }
+ };
+
+ if (!this.options.width) { this.options.width = this.el.width(); }
+ this.mainContainerId = 'AutocompleteContainter_' + uid;
+
+ $('<div id="' + this.mainContainerId + '" style="position:absolute;z-index:9999;"><div class="autocomplete-w1"><div class="autocomplete" id="' + autocompleteElId + '" style="display:none; width:300px;"></div></div></div>').appendTo('body');
+
+ this.container = $('#' + autocompleteElId);
+ this.fixPosition();
+ if (window.opera) {
+ this.el.keypress(function(e) { me.onKeyPress(e); });
+ } else {
+ this.el.keydown(function(e) { me.onKeyPress(e); });
+ }
+ this.el.keyup(function(e) { me.onKeyUp(e); });
+ this.el.blur(function() { me.enableKillerFn(); });
+ this.el.focus(function() { me.fixPosition(); });
+ },
+
+ setOptions: function(options){
+ var o = this.options;
+ $.extend(o, options);
+ if(o.lookup){
+ this.isLocal = true;
+ if($.isArray(o.lookup)){ o.lookup = { suggestions:o.lookup, data:[] }; }
+ }
+ $('#'+this.mainContainerId).css({ zIndex:o.zIndex });
+ this.container.css({ maxHeight: o.maxHeight + 'px', width:o.width });
+ },
+
+ clearCache: function(){
+ this.cachedResponse = [];
+ this.badQueries = [];
+ },
+
+ disable: function(){
+ this.disabled = true;
+ },
+
+ enable: function(){
+ this.disabled = false;
+ },
+
+ fixPosition: function() {
+ var offset = this.el.offset();
+ $('#' + this.mainContainerId).css({ top: (offset.top + this.el.innerHeight()) + 'px', left: offset.left + 'px' });
+ },
+
+ enableKillerFn: function() {
+ var me = this;
+ $(document).bind('click', me.killerFn);
+ },
+
+ disableKillerFn: function() {
+ var me = this;
+ $(document).unbind('click', me.killerFn);
+ },
+
+ killSuggestions: function() {
+ var me = this;
+ this.stopKillSuggestions();
+ this.intervalId = window.setInterval(function() { me.hide(); me.stopKillSuggestions(); }, 300);
+ },
+
+ stopKillSuggestions: function() {
+ window.clearInterval(this.intervalId);
+ },
+
+ onKeyPress: function(e) {
+ if (this.disabled || !this.enabled) { return; }
+ // return will exit the function
+ // and event will not be prevented
+ switch (e.keyCode) {
+ case 27: //KEY_ESC:
+ this.el.val(this.currentValue);
+ this.hide();
+ break;
+ case 9: //KEY_TAB:
+ case 13: //KEY_RETURN:
+ if (this.selectedIndex === -1) {
+ this.hide();
+ return;
+ }
+ this.select(this.selectedIndex);
+ if(e.keyCode === 9){ return; }
+ break;
+ case 38: //KEY_UP:
+ this.moveUp();
+ break;
+ case 40: //KEY_DOWN:
+ this.moveDown();
+ break;
+ default:
+ return;
+ }
+ e.stopImmediatePropagation();
+ e.preventDefault();
+ },
+
+ onKeyUp: function(e) {
+ if(this.disabled){ return; }
+ switch (e.keyCode) {
+ case 38: //KEY_UP:
+ case 40: //KEY_DOWN:
+ return;
+ }
+ clearInterval(this.onChangeInterval);
+ if (this.currentValue !== this.el.val()) {
+ if (this.options.deferRequestBy > 0) {
+ // Defer lookup in case when value changes very quickly:
+ var me = this;
+ this.onChangeInterval = setInterval(function() { me.onValueChange(); }, this.options.deferRequestBy);
+ } else {
+ this.onValueChange();
+ }
+ }
+ },
+
+ onValueChange: function() {
+ clearInterval(this.onChangeInterval);
+ this.currentValue = this.el.val();
+ var q = this.getQuery(this.currentValue);
+ this.selectedIndex = -1;
+ if (this.ignoreValueChange) {
+ this.ignoreValueChange = false;
+ return;
+ }
+ if (q === '' || q.length < this.options.minChars) {
+ this.hide();
+ } else {
+ this.getSuggestions(q);
+ }
+ },
+
+ getQuery: function(val) {
+ var d, arr;
+ d = this.options.delimiter;
+ if (!d) { return $.trim(val); }
+ arr = val.split(d);
+ return $.trim(arr[arr.length - 1]);
+ },
+
+ getSuggestionsLocal: function(q) {
+ var ret, arr, len, val, i;
+ arr = this.options.lookup;
+ len = arr.suggestions.length;
+ ret = { suggestions:[], data:[] };
+ q = q.toLowerCase();
+ for(i=0; i< len; i++){
+ val = arr.suggestions[i];
+ if(val.toLowerCase().indexOf(q) === 0){
+ ret.suggestions.push(val);
+ ret.data.push(arr.data[i]);
+ }
+ }
+ return ret;
+ },
+
+ getSuggestions: function(q) {
+ var cr, me;
+ cr = this.isLocal ? this.getSuggestionsLocal(q) : this.cachedResponse[q];
+ if (cr && $.isArray(cr.suggestions)) {
+ this.suggestions = cr.suggestions;
+ this.data = cr.data;
+ this.suggest();
+ } else if (!this.isBadQuery(q)) {
+ me = this;
+ me.options.params.query = q;
+ $.get(this.serviceUrl, me.options.params, function(txt) { me.processResponse(txt); }, 'text');
+ }
+ },
+
+ isBadQuery: function(q) {
+ var i = this.badQueries.length;
+ while (i--) {
+ if (q.indexOf(this.badQueries[i]) === 0) { return true; }
+ }
+ return false;
+ },
+
+ hide: function() {
+ this.enabled = false;
+ this.selectedIndex = -1;
+ this.container.hide();
+ },
+
+ suggest: function() {
+ if (this.suggestions.length === 0) {
+ this.hide();
+ return;
+ }
+
+ var me, len, div, f, v, i, s, mOver, mClick;
+ me = this;
+ len = this.suggestions.length;
+ f = this.options.fnFormatResult;
+ v = this.getQuery(this.currentValue);
+ mOver = function(xi) { return function() { me.activate(xi); }; };
+ mClick = function(xi) { return function() { me.select(xi); }; };
+ this.container.hide().empty();
+ for (i = 0; i < len; i++) {
+ s = this.suggestions[i];
+ div = $((me.selectedIndex === i ? '<div class="selected"' : '<div') + ' title="' + s + '">' + f(s, this.data[i], v) + '</div>');
+ div.mouseover(mOver(i));
+ div.click(mClick(i));
+ this.container.append(div);
+ }
+ this.enabled = true;
+ this.container.show();
+ },
+
+ processResponse: function(text) {
+ var response;
+ try {
+ response = eval('(' + text + ')');
+ } catch (err) { return; }
+ if (!$.isArray(response.data)) { response.data = []; }
+ if(!this.options.noCache){
+ this.cachedResponse[response.query] = response;
+ if (response.suggestions.length === 0) { this.badQueries.push(response.query); }
+ }
+ if (response.query === this.getQuery(this.currentValue)) {
+ this.suggestions = response.suggestions;
+ this.data = response.data;
+ this.suggest();
+ }
+ },
+
+ activate: function(index) {
+ var divs, activeItem;
+ divs = this.container.children();
+ // Clear previous selection:
+ if (this.selectedIndex !== -1 && divs.length > this.selectedIndex) {
+ $(divs.get(this.selectedIndex)).removeClass();
+ }
+ this.selectedIndex = index;
+ if (this.selectedIndex !== -1 && divs.length > this.selectedIndex) {
+ activeItem = divs.get(this.selectedIndex);
+ $(activeItem).addClass('selected');
+ }
+ return activeItem;
+ },
+
+ deactivate: function(div, index) {
+ div.className = '';
+ if (this.selectedIndex === index) { this.selectedIndex = -1; }
+ },
+
+ select: function(i) {
+ var selectedValue, f;
+ selectedValue = this.suggestions[i];
+ if (selectedValue) {
+ this.el.val(selectedValue);
+ if (this.options.autoSubmit) {
+ f = this.el.parents('form');
+ if (f.length > 0) { f.get(0).submit(); }
+ }
+ this.ignoreValueChange = true;
+ this.hide();
+ this.onSelect(i);
+ }
+ },
+
+ moveUp: function() {
+ if (this.selectedIndex === -1) { return; }
+ if (this.selectedIndex === 0) {
+ this.container.children().get(0).className = '';
+ this.selectedIndex = -1;
+ this.el.val(this.currentValue);
+ return;
+ }
+ this.adjustScroll(this.selectedIndex - 1);
+ },
+
+ moveDown: function() {
+ if (this.selectedIndex === (this.suggestions.length - 1)) { return; }
+ this.adjustScroll(this.selectedIndex + 1);
+ },
+
+ adjustScroll: function(i) {
+ var activeItem, offsetTop, upperBound, lowerBound;
+ activeItem = this.activate(i);
+ offsetTop = activeItem.offsetTop;
+ upperBound = this.container.scrollTop();
+ lowerBound = upperBound + this.options.maxHeight - 25;
+ if (offsetTop < upperBound) {
+ this.container.scrollTop(offsetTop);
+ } else if (offsetTop > lowerBound) {
+ this.container.scrollTop(offsetTop - this.options.maxHeight + 25);
+ }
+ this.el.val(this.getValue(this.suggestions[i]));
+ },
+
+ onSelect: function(i) {
+ var me, fn, s, d;
+ me = this;
+ fn = me.options.onSelect;
+ s = me.suggestions[i];
+ d = me.data[i];
+ me.el.val(me.getValue(s));
+ if ($.isFunction(fn)) { fn(s, d, me.el); }
+ },
+
+ getValue: function(value){
+ var del, currVal, arr, me;
+ me = this;
+ del = me.options.delimiter;
+ if (!del) { return value; }
+ currVal = me.currentValue;
+ arr = currVal.split(del);
+ if (arr.length === 1) { return value; }
+ return currVal.substr(0, currVal.length - arr[arr.length - 1].length) + value;
+ }
+
+ };
+
+}(jQuery));
View
2  app/assets/stylesheets/base.css
@@ -2,3 +2,5 @@
//= require jquery.jgrowl
//= require tablesorter
//= require prettyPhoto
+//= require tags_input
+//= require jquery.autocomplete
View
5 app/assets/stylesheets/jquery.autocomplete.css
@@ -0,0 +1,5 @@
+.autocomplete-w1 { background:url(/assets/shadow.png) no-repeat bottom right; position:absolute; top:0px; left:0px; margin:8px 0 0 6px; /* IE6 fix: */ _background:none; _margin:0; }
+.autocomplete { border:1px solid #999; background:#FFF; cursor:default; text-align:left; max-height:350px; overflow:auto; margin:-6px 6px 6px -6px; /* IE6 specific: */ _height:350px; _margin:0; _overflow-x:hidden; }
+.autocomplete .selected { background:#F0F0F0; }
+.autocomplete div { padding:2px 5px; white-space:nowrap; }
+.autocomplete strong { font-weight:normal; color:#3399FF; }
View
49 app/assets/stylesheets/tags_input.css
@@ -0,0 +1,49 @@
+ul.tags_input{
+ width:100%;
+ background-color:White;
+ border:1px inset;
+ list-style:none;
+ padding:2px;
+ cursor:text;
+}
+
+ul.tags_input>li{
+ display:inline-block;
+ float:left;
+ margin:0px 0 !important;
+}
+
+ul.tags_input>li.tag{
+ padding:4px;
+ background-color:#ddd;
+ margin:1px 1px !important;
+ margin-right:4px !important;
+ border:1px solid #ccc;
+ -webkit-border-radius: 2px;
+ -moz-border-radius: 2px;
+ border-radius: 2px;
+ cursor:default;
+}
+
+ul.tags_input>li.tag>img, ul.tags_input>li.tag>span {
+ float:left;
+}
+
+ul.tags_input>li.tag>img {
+ cursor:pointer;
+ height:8px;width:8px;padding:2px;float:left;
+ margin-left:2px;
+}
+
+ul.tags_input>li.tag>img:hover{
+ background-color:White;
+}
+
+ul.tags_input>li>input{
+ width:160px !important;
+ border:0 !important;
+ padding:0 !important;
+ margin:0 !important;
+ background-color:#FFF;
+ outline: none;
+}
View
7 app/controllers/tags_controller.rb
@@ -0,0 +1,7 @@
+class TagsController < ApplicationController
+ def suggest
+ q = params[:query]
+ suggestions = ActsAsTaggableOn::Tag.find(:all, :select => :name, :conditions => ["name like ?", "#{q}%"] ).collect { |t| t.name }
+ render :json => { :query => q, :suggestions => suggestions }
+ end
+end
View
0  app/inputs/_tags_input.html.erb
No changes.
View
19 app/inputs/tags_input.rb
@@ -0,0 +1,19 @@
+class TagsInput < Formtastic::Inputs::StringInput
+ def to_html
+ puts "this is my modified version of StringInput"
+ input_wrapping do
+ label_html <<
+ builder.hidden_field(method, input_html_options) + "<ul class='tags_input'></ul>".html_safe
+ end
+ end
+
+ def tags_html
+ content_tag(:ul, :class => "list") do
+ collection.collect do |member|
+ content_tag(:li, :id => member.name.gsub(' ', '-').downcase.strip) do
+ member.name
+ end
+ end
+ end
+ end
+end
View
2  app/views/articles/_article_form.html.haml
@@ -7,7 +7,7 @@
- content_form.inputs do
= content_form.input :url, :required => false, :hint => t('article_url_hint')
- = content_form.input :tags_string, :required => false, :hint => t('tags_hint')
+ = content_form.input :tags_string, :required => false, :hint => t('tags_hint'), :as => :tags
#scrollbox
%a.prev.browse.left_scroll
.scrollable
View
2  app/views/articles/edit.html.haml
@@ -77,7 +77,7 @@
= form.semantic_fields_for :content do |content_form|
= content_form.inputs do
= content_form.input :url, :required => false, :label => t('article_url_label'), :hint => t('article_url_hint')
- = content_form.input :tags_string, :required => false, :hint => t('tags_hint')
+ = content_form.input :tags_string, :required => false, :hint => t('tags_hint'), :as => :tags
#article_status= label_tag :status, t('articles.status')
= select_tag :is_draft, options_for_select( { t('articles.draft') => 1, t('articles.publish') => 0 }, (@article.is_draft ? 1 : 0) )
= form.buttons do
View
2  app/views/articles/new.html.haml
@@ -76,7 +76,7 @@
= form.semantic_fields_for :content do |content_form|
= content_form.inputs do
= content_form.input :url, :required => false, :label => t('article_url_label'), :hint => t('article_url_hint')
- = content_form.input :tags_string, :required => false, :hint => t('tags_hint')
+ = content_form.input :tags_string, :required => false, :hint => t('tags_hint'), :as => :tags
#article_status= label_tag :status, t('articles.status')
= select_tag :is_draft, options_for_select( { t('articles.draft') => 1, t('articles.publish') => 0 }, (@article.is_draft ? 1 : 0) )
= form.buttons do
View
2  app/views/events/new.html.haml
@@ -18,7 +18,7 @@
= form.input :tagline, :required => false, :label => t('.label_event_tagline'), :hint => t('.hint_event_tagline')
= form.input :description, :input_html => { :rows => 5 }, :label => t('.label_event_description'), :hint => t('.hint_event_description'), :required => false
= form.input :url, :required => false, :label => t('.label_event_url'), :hint => t('.hint_event_url')
- = form.input :tags_string,:label => t('tags'), :required => false, :hint => t('tags_hint')
+ = form.input :tags_string,:label => t('tags'), :required => false, :hint => t('tags_hint'), :as => :tags
= form.inputs do
.half-panel
= form.input(:start_time, :as => :string, :required =>true)
View
2  app/views/galleries/new.html.haml
@@ -11,7 +11,7 @@
= form.input :title
= form.input :description, :input_html => { :rows => 5 }
= form.input :is_public, :required => false, :hint => t('galleries.public_hint')
- = form.input :tag_list, :label => t('tags'), :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint'), :as => :tags
- @gallery.gallery_items.build if @gallery.gallery_items.empty?
= form.semantic_fields_for :gallery_items do |item_form|
- if @enable_file_uploads
View
2  app/views/ideas/new.html.haml
@@ -64,7 +64,7 @@
= form.input :title, :label => t('.title'), :hint => t('.hint_idea_title')
= form.input :details, :hint => t('.hint_idea_details'), :required => false
= form.input :idea_board, :label => t('.idea_board'), :required => true, :include_blank => false, :hint => t('.hint_idea_boards')
- = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint'), :as => :tags
= form.buttons do
= form.commit_button t('wizard.continue'), :wrapper_html => { :class => 'float-right' }, :button_html => { :class => 'button-input next' }
= form.commit_button t('wizard.post_now'), :wrapper_html => { :class => 'float-right' }, :button_html => { :class => 'button-input' }
View
2  app/views/prediction_groups/new.html.haml
@@ -38,6 +38,6 @@
= form.inputs do
= form.input :title, :label => t('predictions.new.prediction_group_title'), :hint => t('predictions.new.prediction_group_title_hint')
= form.input :description, :hint => t('wizard.details'), :required => false
- = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint'), :as => :tags
= form.buttons do
= form.commit_button t('wizard.submit'), :wrapper_html => { :class => 'float-right' }, :button_html => { :class => 'button-input' }
View
2  app/views/prediction_questions/new.html.haml
@@ -65,6 +65,6 @@
= form.input :list_of_choices, :label => t('predictions.suggested_choices'), :required => true, :hint => t('predictions.suggested_choices_hint'), :wrapper_html => { :class => 'question-values choices hidden' }
= form.input :start_range, :wrapper_html => { :class => 'question-values range hidden' }
= form.input :end_range, :wrapper_html => { :class => 'question-values range hidden' }
- = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint'), :as => :tags
= form.buttons do
= form.commit_button t('wizard.submit'), :wrapper_html => { :class => 'float-right' }, :button_html => { :class => 'button-input' }
View
2  app/views/questions/index.html.haml
@@ -16,7 +16,7 @@
.fullQuestionForm.hide
= form.inputs do
= form.input :details, :required => false, :label => t('please_elaborate')
- = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint'), :as => :tags
= form.buttons do
= form.commit_button :wrapper_html => { :class => 'float-right' }, :button_html => { :class => "button-input create" }
View
2  app/views/questions/new.html.haml
@@ -13,7 +13,7 @@
= form.inputs do
= form.input :question, :required => false, :label => t('What is your Question?')
= form.input :details, :required => false, :label => t('please_elaborate')
- = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :label => t('tags'), :required => false, :hint => t('tags_hint'), :as => :tags
= form.buttons do
= form.commit_button :wrapper_html => { :class => 'float-right' }, :button_html => { :class => "button-input create" }
View
2  app/views/resources/new.html.haml
@@ -71,7 +71,7 @@
.panel2
= form.inputs do
= form.input :details, :input_html => { :rows => 5 },:required => false, :label => t('.label_details'),:hint =>t('.hint_details')
- = form.input :tags_string, :required => false, :label => t('tags'),:hint => t('tags_hint')
+ = form.input :tags_string, :required => false, :label => t('tags'),:hint => t('tags_hint'), :as => :tags
= form.input :mapUrl, :label => t('.label_map'), :hint =>t('.hint_map'),:required => false
= form.input :twitterName, :label => t('.label_twitter'), :hint=>t('.hint_twitter'), :required => false
= form.buttons do
View
2  app/views/stories/_story_form.html.haml
@@ -5,7 +5,7 @@
- if story.newswire.present?
= form.input :newswire_id, :as => :hidden
= form.input :caption, :input_html => { :rows => '10', :cols => '20' }
- = form.input :tags_string, :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :required => false, :hint => t('tags_hint'), :as => :tags
#scrollbox
%a.prev.browse.left_scroll
.scrollable
View
2  app/views/stories/new.html.haml
@@ -77,7 +77,7 @@
- if @story.newswire.present?
= form.input :newswire_id, :as => :hidden
= form.input :caption, :input_html => { :rows => '10', :cols => '20' }
- = form.input :tags_string, :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :required => false, :hint => t('tags_hint'), :as => :tags
= form.buttons do
= form.commit_button t('wizard.continue'), :wrapper_html => { :class => 'float-right' }, :button_html => { :class => 'button-input next' }
= form.commit_button t('wizard.post_now'), :wrapper_html => { :class => 'float-right' }, :button_html => { :class => 'button-input create' }
View
2  app/views/topics/_topic_form.html.haml
@@ -1,5 +1,5 @@
= form.inputs do
= form.input :title
= form.input :body, :as => :text, :input_html => { :rows => '10', :cols => '60' }
- = form.input :tags_string, :required => false, :hint => t('tags_hint')
+ = form.input :tags_string, :required => false, :hint => t('tags_hint'), :as => :tags
View
2  config/routes/main.rb
@@ -124,6 +124,8 @@
match '/classifieds/:id/set_status/:status.:format' => 'classifieds#set_status', :as => :set_status_classified
match '/classifieds/category/:category.:format' => 'classifieds#categories', :as => :categorized_classifieds
match '/classifieds/category/:category/page/:page.:format' => 'classifieds#categories', :as => :categorized_classifieds_with_page
+
+ match '/tags/suggest' => 'tags#suggest', :as => :tags_suggest
resources :users do
collection do
Please sign in to comment.
Something went wrong with that request. Please try again.