muck-shares 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -4,12 +4,14 @@ module MuckSharesHelper
4
4
  render :partial => 'shares/share', :collection => shares
5
5
  end
6
6
 
7
- # parent is the object to which the shares will be attached
8
- # share is the optional parent share for the new share.
9
- def share_form(share = nil, render_new = false)
7
+ # share is an optional share object that can be used to pre populate the form.
8
+ # options:
9
+ # render_new - will determine whether the controller will redirect to new after create or
10
+ # attempt to return to the last page stored by store_location
11
+ def share_form(share = nil, options = {}, &block)
10
12
  share ||= Share.new
11
- render :partial => 'shares/form', :locals => { :share => share, :render_new => render_new }
12
- end
13
+ raw_block_to_partial('shares/form', options.merge(:share => share), &block)
14
+ end
13
15
 
14
16
  # Renders a delete button for a share item
15
17
  def delete_share(share, button_type = :button, button_text = t("muck.general.delete"))
@@ -20,4 +22,8 @@ module MuckSharesHelper
20
22
  :delete_path => share_path(share, :format => 'js') }
21
23
  end
22
24
 
25
+ def already_shared?(user, uri)
26
+ user.shares.find(:all, :conditions => ['uri = ?', uri])
27
+ end
28
+
23
29
  end
@@ -1,3 +1,3 @@
1
1
  <% activity_for(activity, :activity_css_class => 'activity-share') do -%>
2
- shared <%= link_to activity.item.title, activity.item.uri %>. <%= activity.item.message %>
2
+ <%= t('muck.shares.share_activity_content', :link => link_to(activity.item.title, activity.item.uri, :target => '_blank'), :message => activity.item.message) %>
3
3
  <% end -%>
@@ -13,10 +13,9 @@
13
13
  <%= f.text_area :message, { :label => t('muck.shares.message'),
14
14
  :class => 'min' } %>
15
15
  </div>
16
- <%= hidden_field_tag :render_new, render_new ? true : false -%>
16
+ <%= capture(f, &block) %>
17
17
  <div class="button form-row">
18
18
  <%= f.submit t('muck.shares.add_share_button'), :class => "button share-submit", :id => "share_submit_#{share.dom_id}" %>
19
- <%= f.submit t('muck.shares.cancel_share_button'), :class => "button share-submit", :id => "cancel_submit_#{share.dom_id}" %>
20
19
  </div>
21
20
  <% end -%>
22
21
  </div>
@@ -1,5 +1,7 @@
1
1
  <div id="add_share">
2
2
  <h2><%= @page_title %><h2>
3
3
  <%= output_errors(t('muck.shares.problem_adding_share'), {:class => 'help-box'}, @share) %>
4
- <%= share_form(@share, false) %>
4
+ <% share_form(@share) do |f| -%>
5
+ <%= hidden_field_tag :render_new, false -%>
6
+ <% end -%>
5
7
  </div>
@@ -0,0 +1,9 @@
1
+ class AddSharesUriIndex < ActiveRecord::Migration
2
+ def self.up
3
+ add_index :shares, :uri
4
+ end
5
+
6
+ def self.down
7
+ remove_index :shares, :uri
8
+ end
9
+ end
@@ -39,6 +39,7 @@ module ActiveRecord
39
39
  # All the methods available to a record that has had <tt>acts_as_muck_share</tt> specified.
40
40
  module InstanceMethods
41
41
 
42
+ # Adds activities for the share.
42
43
  def add_share_activities(share_to = nil)
43
44
  share_to ||= self.shared_by.feed_to
44
45
  share_to = [share_to] unless share_to.is_a?(Array)
data/locales/en.yml CHANGED
@@ -4,9 +4,10 @@ en:
4
4
  cant_delete_share: "You don't have permission to delete that share"
5
5
  share_removed: "Share successfully removed."
6
6
  create_error: "Could not create the share: {{errors}}"
7
- create_success: "Successfully added share"
7
+ create_success: "Successfully shared page"
8
8
  add_share: "Share"
9
9
  add_share_button: "Share"
10
+ adding_share: "Sharing page..."
10
11
  cancel_share_button: "Cancel"
11
12
  new_share: "Share a Link"
12
13
  problem_adding_share: "There was a problem adding your share"
@@ -15,5 +16,6 @@ en:
15
16
  message: "Message"
16
17
  login_prompt: "Login to share"
17
18
  share_title: "Share This Link"
19
+ share_activity_content: "shared {{link}}. {{message}}"
18
20
  activity_templates:
19
21
  share: Shares
data/muck-shares.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{muck-shares}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Justin Ball"]
9
- s.date = %q{2009-08-04}
9
+ s.date = %q{2009-08-08}
10
10
  s.description = %q{The share engine for the muck system.}
11
11
  s.email = %q{justinball@gmail.com}
12
12
  s.extra_rdoc_files = [
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "config/muck_shares_routes.rb",
29
29
  "db/migrate/20090803185323_create_shares.rb",
30
30
  "db/migrate/20090804184247_add_comment_count_to_shares.rb",
31
+ "db/migrate/20090804231857_add_shares_uri_index.rb",
31
32
  "install.rb",
32
33
  "lib/active_record/acts/muck_share.rb",
33
34
  "lib/active_record/acts/muck_sharer.rb",
@@ -81,6 +82,7 @@ Gem::Specification.new do |s|
81
82
  "test/rails_root/db/migrate/20090730154102_allow_null_user.rb",
82
83
  "test/rails_root/db/migrate/20090803185323_create_shares.rb",
83
84
  "test/rails_root/db/migrate/20090804184247_add_comment_count_to_shares.rb",
85
+ "test/rails_root/db/migrate/20090804231857_add_shares_uri_index.rb",
84
86
  "test/rails_root/features/shares.feature",
85
87
  "test/rails_root/features/step_definitions/common_steps.rb",
86
88
  "test/rails_root/features/step_definitions/share_steps.rb",
@@ -328,6 +330,7 @@ Gem::Specification.new do |s|
328
330
  "test/rails_root/db/migrate/20090730154102_allow_null_user.rb",
329
331
  "test/rails_root/db/migrate/20090803185323_create_shares.rb",
330
332
  "test/rails_root/db/migrate/20090804184247_add_comment_count_to_shares.rb",
333
+ "test/rails_root/db/migrate/20090804231857_add_shares_uri_index.rb",
331
334
  "test/rails_root/db/schema.rb",
332
335
  "test/rails_root/features/step_definitions/common_steps.rb",
333
336
  "test/rails_root/features/step_definitions/share_steps.rb",
@@ -0,0 +1,9 @@
1
+ class AddSharesUriIndex < ActiveRecord::Migration
2
+ def self.up
3
+ add_index :shares, :uri
4
+ end
5
+
6
+ def self.down
7
+ remove_index :shares, :uri
8
+ end
9
+ end
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # It's strongly recommended to check this file into your version control system.
11
11
 
12
- ActiveRecord::Schema.define(:version => 20090804184247) do
12
+ ActiveRecord::Schema.define(:version => 20090804211240) do
13
13
 
14
14
  create_table "activities", :force => true do |t|
15
15
  t.integer "item_id"
@@ -106,6 +106,7 @@ ActiveRecord::Schema.define(:version => 20090804184247) do
106
106
  t.datetime "created_at"
107
107
  t.datetime "updated_at"
108
108
  t.integer "comment_count", :default => 0
109
+ t.integer "resource_id"
109
110
  end
110
111
 
111
112
  add_index "shares", ["shared_by_id"], :name => "index_shares_on_shared_by_id"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-shares
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-04 00:00:00 -06:00
12
+ date: 2009-08-08 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -76,6 +76,7 @@ files:
76
76
  - config/muck_shares_routes.rb
77
77
  - db/migrate/20090803185323_create_shares.rb
78
78
  - db/migrate/20090804184247_add_comment_count_to_shares.rb
79
+ - db/migrate/20090804231857_add_shares_uri_index.rb
79
80
  - install.rb
80
81
  - lib/active_record/acts/muck_share.rb
81
82
  - lib/active_record/acts/muck_sharer.rb
@@ -129,6 +130,7 @@ files:
129
130
  - test/rails_root/db/migrate/20090730154102_allow_null_user.rb
130
131
  - test/rails_root/db/migrate/20090803185323_create_shares.rb
131
132
  - test/rails_root/db/migrate/20090804184247_add_comment_count_to_shares.rb
133
+ - test/rails_root/db/migrate/20090804231857_add_shares_uri_index.rb
132
134
  - test/rails_root/features/shares.feature
133
135
  - test/rails_root/features/step_definitions/common_steps.rb
134
136
  - test/rails_root/features/step_definitions/share_steps.rb
@@ -394,6 +396,7 @@ test_files:
394
396
  - test/rails_root/db/migrate/20090730154102_allow_null_user.rb
395
397
  - test/rails_root/db/migrate/20090803185323_create_shares.rb
396
398
  - test/rails_root/db/migrate/20090804184247_add_comment_count_to_shares.rb
399
+ - test/rails_root/db/migrate/20090804231857_add_shares_uri_index.rb
397
400
  - test/rails_root/db/schema.rb
398
401
  - test/rails_root/features/step_definitions/common_steps.rb
399
402
  - test/rails_root/features/step_definitions/share_steps.rb