Permalink
Browse files

jquery.tagit

  • Loading branch information...
1 parent a0b7782 commit 52e6e3dff2e0dfb089c608131af67024740ebc05 @szemek committed Jan 31, 2013
View
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.11'
gem 'jquery-rails'
+gem 'jquery-ui-rails'
gem 'haml-rails', '>= 0.3.4'
gem 'choices'
View
@@ -116,6 +116,9 @@ GEM
jquery-rails (2.2.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
+ jquery-ui-rails (3.0.1)
+ jquery-rails
+ railties (>= 3.1.0)
json (1.7.6)
jwt (0.1.5)
multi_json (>= 1.0)
@@ -266,6 +269,7 @@ DEPENDENCIES
guard-spork
haml-rails (>= 0.3.4)
jquery-rails
+ jquery-ui-rails
launchy
mongoid
nokogiri
@@ -12,5 +12,6 @@
//
//= require jquery
//= require jquery_ujs
+//= require jquery.ui.all
//= require pusher.min
//= require_tree .

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,5 @@
+$(document).ready(function() {
+ $('#link_tag_list').tagit({
+ availableTags: []
+ });
+});
@@ -0,0 +1,67 @@
+ul.tagit {
+ padding: 1px 5px;
+ overflow: auto;
+ margin-left: inherit; /* usually we don't want the regular ul margins. */
+ margin-right: inherit;
+}
+ul.tagit li {
+ display: block;
+ float: left;
+ margin: 2px 5px 2px 0;
+}
+ul.tagit li.tagit-choice {
+ position: relative;
+ line-height: inherit;
+}
+
+ul.tagit li.tagit-choice-read-only {
+ padding: .2em .5em .2em .5em;
+}
+
+ul.tagit li.tagit-choice-editable {
+ padding: .2em 18px .2em .5em;
+}
+
+ul.tagit li.tagit-new {
+ padding: .25em 4px .25em 0;
+}
+
+ul.tagit li.tagit-choice a.tagit-label {
+ cursor: pointer;
+ text-decoration: none;
+}
+ul.tagit li.tagit-choice .tagit-close {
+ cursor: pointer;
+ position: absolute;
+ right: .1em;
+ top: 50%;
+ margin-top: -8px;
+ line-height: 17px;
+}
+
+/* used for some custom themes that don't need image icons */
+ul.tagit li.tagit-choice .tagit-close .text-icon {
+ display: none;
+}
+
+ul.tagit li.tagit-choice input {
+ display: block;
+ float: left;
+ margin: 2px 5px 2px 0;
+}
+ul.tagit input[type="text"] {
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+
+ -moz-box-shadow: none;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+
+ border: none;
+ margin: 0;
+ padding: 0;
+ width: inherit;
+ background-color: inherit;
+ outline: none;
+}
@@ -0,0 +1,56 @@
+
+/* Optional scoped theme for tag-it which mimics the zendesk widget. */
+
+
+ul.tagit {
+ border-style: solid;
+ border-width: 1px;
+ border-color: #C6C6C6;
+ background: inherit;
+}
+ul.tagit li.tagit-choice {
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ -webkit-border-radius: 6px;
+ border: 1px solid #CAD8F3;
+
+ background: none;
+ background-color: #DEE7F8;
+
+ font-weight: normal;
+}
+ul.tagit li.tagit-choice .tagit-label:not(a) {
+ color: #555;
+}
+ul.tagit li.tagit-choice a.tagit-close {
+ text-decoration: none;
+}
+ul.tagit li.tagit-choice .tagit-close {
+ right: .4em;
+}
+ul.tagit li.tagit-choice .ui-icon {
+ display: none;
+}
+ul.tagit li.tagit-choice .tagit-close .text-icon {
+ display: inline;
+ font-family: arial, sans-serif;
+ font-size: 16px;
+ line-height: 16px;
+ color: #777;
+}
+ul.tagit li.tagit-choice:hover, ul.tagit li.tagit-choice.remove {
+ background-color: #bbcef1;
+ border-color: #6d95e0;
+}
+ul.tagit li.tagit-choice a.tagLabel:hover,
+ul.tagit li.tagit-choice a.tagit-close .text-icon:hover {
+ color: #222;
+}
+ul.tagit input[type="text"] {
+ color: #333333;
+ background: none;
+}
+.ui-widget {
+ font-size: 1.1em;
+}
+
View
@@ -1,7 +1,9 @@
class Link < ActiveRecord::Base
- attr_accessible :title, :address, :description
+ attr_accessible :title, :address, :description, :tag_list
validates :title, :address, :presence => true
belongs_to :user
+
+ acts_as_taggable
end
@@ -23,6 +23,10 @@
<%= f.label :description, "Opis" %>
<%= f.text_area :description %>
</div>
+ <div class="field">
+ <%= f.label :tag_list, "Tagi" %>
+ <%= f.text_field :tag_list %>
+ </div>
<div class="actions">
<%= f.submit "Zapisz", :class => 'btn btn-success' %>
</div>

0 comments on commit 52e6e3d

Please sign in to comment.