clipster 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/MIT-LICENSE +20 -20
  2. data/README.md +72 -0
  3. data/Rakefile +34 -34
  4. data/app/assets/images/clipster/rss_logo_small.png +0 -0
  5. data/app/assets/javascripts/clipster/application.js +15 -15
  6. data/app/assets/javascripts/clipster/bootstrap.js +2026 -2026
  7. data/app/assets/javascripts/clipster/bootstrap.min.js +5 -5
  8. data/app/assets/javascripts/clipster/clip.js +2 -2
  9. data/app/assets/javascripts/clipster/clips.js +7 -2
  10. data/app/assets/javascripts/clipster/users.js +2 -0
  11. data/app/assets/stylesheets/clipster/application.css +27 -27
  12. data/app/assets/stylesheets/clipster/bootstrap.css +5774 -5774
  13. data/app/assets/stylesheets/clipster/clip.css +31 -21
  14. data/app/assets/stylesheets/clipster/clips.css +4 -4
  15. data/app/assets/stylesheets/clipster/users.css +4 -0
  16. data/app/controllers/clipster/application_controller.rb +14 -7
  17. data/app/controllers/clipster/clips_controller.rb +86 -80
  18. data/app/controllers/clipster/users_controller.rb +17 -0
  19. data/app/helpers/clipster/application_helper.rb +19 -4
  20. data/app/helpers/clipster/clip_helper.rb +4 -4
  21. data/app/helpers/clipster/clips_helper.rb +4 -4
  22. data/app/helpers/clipster/users_helper.rb +4 -0
  23. data/app/models/clipster/clip.rb +99 -74
  24. data/app/views/clipster/clips/about.html.erb +14 -14
  25. data/app/views/clipster/clips/create.html.erb +56 -46
  26. data/app/views/clipster/clips/list.atom.builder +22 -0
  27. data/app/views/clipster/clips/list.html.erb +60 -43
  28. data/app/views/clipster/clips/show.html.erb +8 -8
  29. data/app/views/clipster/users/index.html.erb +2 -0
  30. data/app/views/clipster/users/show.html.erb +46 -0
  31. data/app/views/kaminari/_first_page.html.erb +3 -3
  32. data/app/views/kaminari/_gap.html.erb +3 -3
  33. data/app/views/kaminari/_last_page.html.erb +3 -3
  34. data/app/views/kaminari/_next_page.html.erb +3 -3
  35. data/app/views/kaminari/_page.html.erb +3 -3
  36. data/app/views/kaminari/_paginator.html.erb +17 -17
  37. data/app/views/kaminari/_prev_page.html.erb +3 -3
  38. data/app/views/layouts/clipster/application.html.erb +62 -49
  39. data/config/routes.rb +16 -14
  40. data/config/schedule.rb +10 -10
  41. data/db/migrate/20121004010757_create_clipster_clips.rb +16 -16
  42. data/db/migrate/20121007154400_add_hash_index_to_clips.rb +13 -13
  43. data/db/migrate/20121007155125_populate_clip_defaults.rb +21 -21
  44. data/db/migrate/20121007162741_rename_hash_to_url_hash.rb +9 -9
  45. data/db/migrate/20121007223358_remove_default_from_language.rb +9 -9
  46. data/db/migrate/20121007223631_set_default_title_to_untitled.rb +9 -9
  47. data/db/migrate/20121105212724_add_lifespan_to_clips.rb +9 -9
  48. data/db/migrate/20121114175749_add_user_id_to_clips.rb +9 -0
  49. data/lib/clipster/configuration.rb +23 -0
  50. data/lib/clipster/engine.rb +23 -15
  51. data/lib/clipster/version.rb +3 -3
  52. data/lib/clipster.rb +5 -4
  53. data/lib/generators/clipster/install_generator.rb +19 -0
  54. data/lib/generators/templates/clipster.rb +12 -0
  55. data/lib/tasks/clipster_tasks.rake +4 -4
  56. metadata +16 -4
  57. data/README.rdoc +0 -54
@@ -1,22 +1,32 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
5
-
6
- .bordered {
7
- border: 1px solid #dddddd;
8
- border-collapse: separate;
9
- *border-collapse: collapse;
10
- /*border-left: 0;*/
11
- -webkit-border-radius: 4px;
12
- -moz-border-radius: 4px;
13
- border-radius: 4px;
14
- }
15
-
16
- .bordered div {
17
- margin: 5px;
18
- }
19
-
20
- .title {
21
- border-bottom: 1px solid #ddd;
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
5
+
6
+ .bordered {
7
+ border: 1px solid #dddddd;
8
+ border-collapse: separate;
9
+ *border-collapse: collapse;
10
+ /*border-left: 0;*/
11
+ -webkit-border-radius: 4px;
12
+ -moz-border-radius: 4px;
13
+ border-radius: 4px;
14
+ }
15
+
16
+ .bordered div {
17
+ margin: 5px;
18
+ }
19
+
20
+ .title {
21
+ border-bottom: 1px solid #ddd;
22
+ }
23
+
24
+ .help-tip label{
25
+ display: inline;
26
+ }
27
+
28
+ .image-feed {
29
+ width: 14px;
30
+ height: 14px;
31
+ background:url("../Clipster/rss_logo_small.png");
22
32
  }
@@ -1,4 +1,4 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -1,7 +1,14 @@
1
- module Clipster
2
- class ApplicationController < ActionController::Base
3
- def index
4
- render :text => "Welcome 2 Clipster"
5
- end
6
- end
7
- end
1
+ module Clipster
2
+ class ApplicationController < ActionController::Base
3
+ before_filter :set_current_user
4
+
5
+ private
6
+ def set_current_user
7
+ begin
8
+ Clip.current_user = current_user if Clipster.config.associates_clip_with_user
9
+ rescue Exception => e
10
+ raise "If User assocations have been enabled for Clipster, your application should have a current_user helper defined"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,80 +1,86 @@
1
- require_dependency "clipster/application_controller"
2
-
3
- module Clipster
4
- class ClipsController < ApplicationController
5
- def index
6
- create
7
- render 'create'
8
- end
9
-
10
- def list
11
- # get all clips, with the newest clip first
12
- if params[:lang].nil?
13
- @clips = Clip.public.order('created_at DESC').page(params[:page])
14
- else
15
- @clips = Clip.language_for_public(params[:lang]).order('created_at DESC').page(params[:page])
16
- end
17
-
18
- @languages = Clip.public.select("language, count(*) as count").group(:language)
19
- end
20
-
21
- def create
22
- @clip = Clip.new(params[:clip])
23
-
24
- #only do validation if something was actually posted.
25
- if !params[:clip].nil? && @clip.valid?
26
- @clip.save
27
- redirect_to @clip
28
- return #early return so we don't have else statement
29
- end
30
-
31
- # Get all languages we have syntax for and remove debugging languages.
32
- @languages = get_languages
33
- end
34
-
35
- def show
36
- @clip = Clip.where("url_hash = :id and (expires is null OR expires > :now)",{
37
- :id => params[:id],
38
- :now => DateTime.now
39
- }).first
40
-
41
- if @clip.nil?
42
- # Most likely the clip is expired, take advantage of this time to
43
- # clean up all expired clips, then display error page
44
- Clip.delete_expired_clips
45
- render :expired
46
- return
47
- end
48
-
49
- cr_scanner = CodeRay.scan(@clip.clip, @clip.language)
50
-
51
- # Only show line numbers if its greater than 1
52
- @clip_div = cr_scanner.div
53
- @clip_div = cr_scanner.div(:line_numbers => :table) unless cr_scanner.loc <= 1
54
- end
55
-
56
- def search
57
- @clips = Clip.search(params[:search_term])
58
-
59
- p '\n\n\n\n'
60
- p @clips
61
-
62
- @languages = Clip.select("language, count(*) as count").group(:language)
63
-
64
- render 'list' unless @clips.nil?
65
- end
66
-
67
- def about
68
- end
69
-
70
- private
71
-
72
- def get_languages
73
- languages = CodeRay::Scanners.all_plugins
74
- languages.delete(CodeRay::Scanners::Raydebug)
75
- languages.delete(CodeRay::Scanners::Debug)
76
-
77
- languages
78
- end
79
- end
80
- end
1
+ require_dependency "clipster/application_controller"
2
+
3
+ module Clipster
4
+ class ClipsController < ApplicationController
5
+ def index
6
+ create
7
+ render 'create'
8
+ end
9
+
10
+ def list
11
+ # get all clips, with the newest clip first
12
+ if params[:lang].nil?
13
+ @clips = Clip.public.order('created_at DESC').page(params[:page])
14
+ else
15
+ @clips = Clip.language_for_public(params[:lang]).order('created_at DESC').page(params[:page])
16
+ end
17
+
18
+ @languages = Clip.public.select("language, count(*) as count").group(:language)
19
+ @updated_at = @clips.first.updated_at unless @clips.empty?
20
+
21
+ respond_to do |format|
22
+ format.html
23
+ format.atom
24
+ end
25
+ end
26
+
27
+ # TODO: refactor to do proper RESTful controller
28
+ def new
29
+ create
30
+ render 'create'
31
+ end
32
+
33
+ def create
34
+ @clip = Clip.new(params[:clip])
35
+
36
+ #only do validation if something was actually posted.
37
+ if !params[:clip].nil? && @clip.valid?
38
+ @clip.save
39
+ redirect_to @clip
40
+ return #early return so we don't have else statement
41
+ end
42
+
43
+ # Get all languages we have syntax for and remove debugging languages.
44
+ @languages = get_languages
45
+ end
46
+
47
+ def show
48
+ @clip = Clip.where("url_hash = :id and (expires is null OR expires > :now)",{
49
+ :id => params[:id],
50
+ :now => DateTime.now
51
+ }).first
52
+
53
+ if @clip.nil?
54
+ # Most likely the clip is expired, take advantage of this time to
55
+ # clean up all expired clips, then display error page
56
+ Clip.delete_expired_clips
57
+ render :expired
58
+ return
59
+ end
60
+ end
61
+
62
+ def search
63
+ @clips = Clip.search(params[:search_term]).page(params[:page])
64
+
65
+ p '\n\n\n\n'
66
+ p @clips
67
+
68
+ @languages = Clip.select("language, count(*) as count").group(:language)
69
+
70
+ render 'list' unless @clips.nil?
71
+ end
72
+
73
+ def about
74
+ end
75
+
76
+ private
77
+
78
+ def get_languages
79
+ languages = CodeRay::Scanners.all_plugins
80
+ languages.delete(CodeRay::Scanners::Raydebug)
81
+ languages.delete(CodeRay::Scanners::Debug)
82
+
83
+ languages
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,17 @@
1
+ require_dependency "clipster/application_controller"
2
+
3
+ module Clipster
4
+ class UsersController < ApplicationController
5
+ def index
6
+
7
+ end
8
+
9
+ def show
10
+ @user = Clipster.config.user_class.find(params[:id])
11
+
12
+ @clips = Clip.public.where(:user_id => @user.id).page(params[:page])
13
+
14
+ @languages = Clip.select("language, count(*) as count").group(:language)
15
+ end
16
+ end
17
+ end
@@ -1,4 +1,19 @@
1
- module Clipster
2
- module ApplicationHelper
3
- end
4
- end
1
+ module Clipster
2
+ module ApplicationHelper
3
+ def get_languages
4
+ languages = CodeRay::Scanners.all_plugins
5
+ languages.delete(CodeRay::Scanners::Raydebug)
6
+ languages.delete(CodeRay::Scanners::Debug)
7
+
8
+ languages
9
+ end
10
+
11
+ def get_language_counts
12
+ Clip.select("language, count(*) as count").group(:language)
13
+ end
14
+
15
+ def display_user_text(user)
16
+ user.send(Clipster.config.user_display_attribute)
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,4 @@
1
- module Clipster
2
- module ClipHelper
3
- end
4
- end
1
+ module Clipster
2
+ module ClipHelper
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- module Clipster
2
- module ClipsHelper
3
- end
4
- end
1
+ module Clipster
2
+ module ClipsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Clipster
2
+ module UsersHelper
3
+ end
4
+ end
@@ -1,74 +1,99 @@
1
- module Clipster
2
- class Clip < ActiveRecord::Base
3
- include ActionView::Helpers::DateHelper
4
- before_create :init_id
5
- self.primary_key = :url_hash
6
- attr_accessible :clip, :language, :title, :private, :expires, :lifespan
7
- cattr_reader :lifespans
8
-
9
- # Define all supported lifespans and their time offset
10
- @@lifespans = {"Forever" => nil,
11
- "An Hour" => {:hours=>1},
12
- "A Week" => {:days=>7},
13
- "A Day" => {:days=>1},
14
- "A Month" => {:months=>1},
15
- "A Year" => {:years=>1}}
16
-
17
- # TODO: build more powerful search term creation
18
- scope :search, lambda {|term|
19
- where("(title LIKE :term or language LIKE :term or clip LIKE :term) and (expires is null OR expires > :now)",{
20
- :term => term,
21
- :now => DateTime.now
22
- })
23
- }
24
-
25
- # All clips that are public, language specific, and not expired
26
- scope :language_for_public, lambda {|lang|
27
- where("private = :private AND
28
- language = :lang AND
29
- (expires is null OR expires > :now)",{
30
- :private => false,
31
- :lang => lang,
32
- :now => DateTime.now
33
- })
34
- }
35
-
36
- # All clips that are public, and not expired
37
- scope :public, lambda {
38
- where("private = :private AND
39
- (expires is null OR expires > :now)",{
40
- :private => false,
41
- :now => DateTime.now
42
- })
43
- }
44
-
45
- validates :clip, :length => {:minimum => 3}
46
- validates :title, :length => {:minimum => 1}
47
-
48
- # Setter to convert user's choice of 'A Week', etc. to an actual DateTime
49
- def lifespan=(lifespan)
50
- unless @@lifespans[lifespan].nil?
51
- self.expires = DateTime.now.advance(@@lifespans[lifespan])
52
- end
53
- end
54
-
55
- # Getter to convert an expire date to '1 Month', '1 Year', etc.
56
- def lifespan
57
- unless self.expires.nil?
58
- time_ago_in_words(self.expires)
59
- else
60
- "the end of time"
61
- end
62
- end
63
-
64
- # Utility method called by either cron job or when an expired clip is accessed
65
- def Clip.delete_expired_clips
66
- Clip.destroy_all(["expires is not null AND expires <= ?", DateTime.now])
67
- end
68
-
69
- private
70
- def init_id
71
- self.url_hash = Time.now.to_f.to_s.gsub('.','').to_i.to_s(36)
72
- end
73
- end
74
- end
1
+ module Clipster
2
+ class Clip < ActiveRecord::Base
3
+ include ActionView::Helpers::DateHelper
4
+
5
+ self.primary_key = :url_hash
6
+
7
+ before_create :default_values
8
+
9
+ attr_accessible :clip, :language, :title, :private, :expires, :lifespan
10
+ cattr_reader :lifespans
11
+ cattr_accessor :current_user, :lifespan
12
+
13
+ belongs_to :user, :class_name => Clipster.config.user_class.to_s unless not Clipster.config.associates_clip_with_user
14
+
15
+ validates :clip, :length => {:minimum => 3}
16
+ validates :title, :length => {:minimum => 1}
17
+
18
+ # Define all supported lifespans and their time offset
19
+ @@lifespans = [["Forever", nil],
20
+ ["An Hour", :hours=>1],
21
+ ["A Week", :days=>7],
22
+ ["A Day", :days=>1],
23
+ ["A Month", :months=>1],
24
+ ["A Year", :years=>1]]
25
+
26
+ # TODO: build more powerful search term creation
27
+ scope :search, lambda {|term|
28
+ where("(title LIKE :term or language LIKE :term or clip LIKE :term) and (expires is null OR expires > :now)",{
29
+ :term => term,
30
+ :now => DateTime.now
31
+ })
32
+ }
33
+
34
+ # All clips that are public, language specific, and not expired
35
+ scope :language_for_public, lambda {|lang|
36
+ where("private = :private AND
37
+ language = :lang AND
38
+ (expires is null OR expires > :now)",{
39
+ :private => false,
40
+ :lang => lang,
41
+ :now => DateTime.now
42
+ })
43
+ }
44
+
45
+ # All clips that are public, and not expired
46
+ scope :public, lambda {
47
+ where("private = :private AND
48
+ (expires is null OR expires > :now)",{
49
+ :private => false,
50
+ :now => DateTime.now
51
+ })
52
+ }
53
+
54
+ # Setter to convert user's choice of 'A Week', etc. to an actual DateTime
55
+ def lifespan=(lifespan)
56
+ @lifespan = lifespan
57
+ @@lifespans.each_with_index do |span, index|
58
+ if span[0] == lifespan
59
+ self.expires = DateTime.now.advance(@@lifespans[index][1])
60
+ end
61
+ end
62
+ end
63
+
64
+ def lifespan
65
+ @lifespan
66
+ end
67
+
68
+ # Getter to convert an expire date to '1 Month', '1 Year', etc.
69
+ def expires_in_words
70
+ unless self.expires.nil?
71
+ time_ago_in_words(self.expires).humanize
72
+ else
73
+ "The end of time"
74
+ end
75
+ end
76
+
77
+ # Utility method called by either cron job or when an expired clip is accessed
78
+ def Clip.delete_expired_clips
79
+ Clip.destroy_all(["expires is not null AND expires <= ?", DateTime.now])
80
+ end
81
+
82
+ # Creates the div for the clip
83
+ def div
84
+ cr_scanner = CodeRay.scan(self.clip, self.language)
85
+ # Only show line numbers if its greater than 1
86
+ if cr_scanner.loc <= 1
87
+ return cr_scanner.div
88
+ else
89
+ return cr_scanner.div(:line_numbers => :table)
90
+ end
91
+ end
92
+
93
+ private
94
+ def default_values
95
+ self.user_id = self.current_user unless not Clipster.config.associates_clip_with_user
96
+ self.url_hash = Time.now.to_f.to_s.gsub('.','').to_i.to_s(36)
97
+ end
98
+ end
99
+ end
@@ -1,15 +1,15 @@
1
- <legend>About Clipster</legend>
2
-
3
- <div class="span10 offset1">
4
- <p>Clipster is an Open Source Rails engine to add clipboard code sharing to your existing Ruby on Rails applications. Complete with syntax highlighting and expiring clips, its great for internal code sharing. Please visit us on <%= link_to("GitHub", "http://github.com/kwbock/clipster") %> for downloads and support.</p>
5
- </div>
6
-
7
- <div class="well span9 offset1">
8
- <p>Copyright 2012 Kyle Bock, Daniel White</p>
9
-
10
- <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
11
-
12
- <p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.<p>
13
-
14
- <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
1
+ <legend>About Clipster v.<%=Clipster::VERSION%></legend>
2
+
3
+ <div class="span10 offset1">
4
+ <p>Clipster is an Open Source Rails engine to add clipboard code sharing to your existing Ruby on Rails applications. Complete with syntax highlighting and expiring clips, its great for internal code sharing. Please visit us on <%= link_to("GitHub", "http://github.com/kwbock/clipster") %> for downloads and support.</p>
5
+ </div>
6
+
7
+ <div class="well span9 offset1">
8
+ <p>Copyright 2012 Kyle Bock, Daniel White</p>
9
+
10
+ <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
11
+
12
+ <p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.<p>
13
+
14
+ <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
15
15
  </div>
@@ -1,47 +1,57 @@
1
- <legend>New Clip</legend>
2
-
3
- <%= form_for(@clip, :url => { :action => "create" }) do |f| %>
4
- <%= f.error_messages %>
5
-
6
- <!-- title -->
7
- <div class="span5 offset1">
8
- <div class="span4 no-left">
9
- <%= f.label(:title) %>
10
- <%= f.text_field(:title, :value => @clip.title, :required=>"required") %>
11
- </div>
12
- <!-- /title -->
13
-
14
- <!-- language -->
15
- <div class="span4 no-left">
16
- <%= f.label(:language) %>
17
- <%= f.collection_select("language", @languages, :lang, :title, :selected => (@clip.language || "text")) %>
18
- </div>
19
- <!-- /language -->
20
- </div>
21
- <div class="span5 offset1 pull-right no-left">
22
- <!-- lifespan -->
23
- <div class="span4">
24
- <%= f.label(:lifespan) %>
25
- <%= f.select(:lifespan, @clip.lifespans) %>
26
- </div>
27
- <!-- /lifespan -->
28
-
29
- <!-- private -->
30
- <div class="span4">
31
- <%= f.label(:private) %>
32
- <%= f.check_box(:private, :value => @clip.private) %>
33
- </div>
34
- <!-- /private -->
35
- </div>
36
-
37
- <!-- clip -->
38
- <div class="span10 offset1">
39
- <%= f.label(:clip) %>
40
- <%= f.text_area(:clip, :class=>"span10", :rows=>"15", :value => @clip.clip, :required=>"required") %>
41
- </div>
42
- <!-- /clip -->
43
-
44
- <div class="span2 pull-right">
45
- <%= f.submit(:class=>"btn btn-primary") %>
46
- </div>
1
+ <legend>New Clip</legend>
2
+
3
+ <%= form_for(@clip, :url => { :action => "create" }) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <!-- 1st Row -->
7
+ <div class="span5 offset1">
8
+ <!-- title -->
9
+ <div class="span4 no-left">
10
+ <div class="help-tip">
11
+ <%= f.label(:title) %> <i class="icon-question-sign" data-title="Name your clip"></i></div>
12
+ <%= f.text_field(:title, :value => @clip.title, :required=>"required") %>
13
+ </div>
14
+ <!-- /title -->
15
+
16
+ <!-- language -->
17
+ <div class="span4 no-left">
18
+ <div class="help-tip">
19
+ <%= f.label(:language) %> <i class="icon-question-sign" data-title="Choose a language for syntax highlighting"></i></div>
20
+ <%= f.collection_select("language", @languages, :lang, :title, :selected => (@clip.language || "text")) %>
21
+ </div>
22
+ <!-- /language -->
23
+ </div>
24
+ <!-- /1st Row -->
25
+
26
+ <!-- 2nd Row -->
27
+ <div class="span5 offset1 pull-right no-left">
28
+ <!-- lifespan -->
29
+ <div class="span4">
30
+ <div class="help-tip">
31
+ <%= f.label(:lifespan) %> <i class="icon-question-sign" data-title="Choose how long the clip should remain available"></i></div>
32
+ <%= f.select(:lifespan, @clip.lifespans, :selected=>(@clip.lifespan || "Forever")) %>
33
+ </div>
34
+ <!-- /lifespan -->
35
+
36
+ <!-- private -->
37
+ <div class="span4">
38
+ <div class="help-tip">
39
+ <%= f.label(:private) %> <i class="icon-question-sign" data-title="Only allow those with a link to access the clip"></i></div>
40
+ <%= f.check_box(:private, :value => @clip.private) %>
41
+ </div>
42
+ <!-- /private -->
43
+ </div>
44
+ <!-- /2nd Row -->
45
+
46
+ <!-- clip -->
47
+ <div class="span10 offset1">
48
+ <div class="help-tip">
49
+ <%= f.label(:clip) %> <i class="icon-question-sign" data-title="The main content to be shared"></i></div>
50
+ <%= f.text_area(:clip, :class=>"span10", :rows=>"15", :value => @clip.clip, :required=>"required") %>
51
+ </div>
52
+ <!-- /clip -->
53
+
54
+ <div class="span2 pull-right">
55
+ <%= f.submit(:class=>"btn btn-primary") %>
56
+ </div>
47
57
  <% end %>