enju_news 0.1.0.pre2 → 0.1.0.pre3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5697b218da9d2850ccad0aed81b690dead11367a
4
+ data.tar.gz: 7ac66fa6bb03f51c1987483fdaaafcf0903e3468
5
+ SHA512:
6
+ metadata.gz: 97ea6d0013f698d6f65f8035b40a410b2267dcd70f787574855c0ac13f23a15116eec01d779162d6508ded1a4ea2282ae1e805bafa97b2e3095b7a8ae65900a2
7
+ data.tar.gz: 3ffc2306d269efe8772b95916696540c24bbbcbfc35b43f17ad0212f52c5a3e0b3f5466997a288698457fcfb473d38adda73706e28735d151bf2039a251b7d5b
@@ -92,6 +92,7 @@ class NewsPostsController < ApplicationController
92
92
  end
93
93
  end
94
94
 
95
+ private
95
96
  def prepare_options
96
97
  @roles = Role.all
97
98
  end
@@ -0,0 +1,18 @@
1
+ module EnjuNews
2
+ class Ability
3
+ include CanCan::Ability
4
+
5
+ def initialize(user, ip_address = nil)
6
+ case user.try(:role).try(:name)
7
+ when 'Administrator'
8
+ can :manage, [NewsFeed, NewsPost]
9
+ when 'Librarian'
10
+ can :read, [NewsFeed, NewsPost]
11
+ when 'User'
12
+ can :read, [NewsPost]
13
+ else
14
+ can :read, [NewsPost]
15
+ end
16
+ end
17
+ end
18
+ end
@@ -81,3 +81,18 @@ class NewsFeed < ActiveRecord::Base
81
81
  end
82
82
  end
83
83
  end
84
+
85
+ # == Schema Information
86
+ #
87
+ # Table name: news_feeds
88
+ #
89
+ # id :integer not null, primary key
90
+ # library_group_id :integer default(1), not null
91
+ # title :string(255)
92
+ # url :string(255)
93
+ # body :text
94
+ # position :integer
95
+ # created_at :datetime not null
96
+ # updated_at :datetime not null
97
+ #
98
+
@@ -14,3 +14,23 @@ class NewsPost < ActiveRecord::Base
14
14
  10
15
15
  end
16
16
  end
17
+
18
+ # == Schema Information
19
+ #
20
+ # Table name: news_posts
21
+ #
22
+ # id :integer not null, primary key
23
+ # title :text
24
+ # body :text
25
+ # user_id :integer
26
+ # start_date :datetime
27
+ # end_date :datetime
28
+ # required_role_id :integer default(1), not null
29
+ # note :text
30
+ # position :integer
31
+ # draft :boolean default(FALSE), not null
32
+ # created_at :datetime not null
33
+ # updated_at :datetime not null
34
+ # url :string(255)
35
+ #
36
+
@@ -13,14 +13,14 @@
13
13
  <%- @news_feeds.each do |news_feed| -%>
14
14
  <tr class="line<%= cycle("0", "1") -%>">
15
15
  <td>
16
- <%- if can? :destroy, news_feed -%>
16
+ <%- if can? :delete, news_feed -%>
17
17
  <%= move_position(news_feed) -%>
18
18
  <%- end -%>
19
19
  </td>
20
20
  <td><%= link_to h(news_feed.title), news_feed -%></td>
21
21
  <td><%= link_to h(news_feed.url), news_feed.url -%></td>
22
22
  <td>
23
- <%- if can? :destroy, news_feed -%>
23
+ <%- if can? :delete, news_feed -%>
24
24
  <%= link_to t('page.edit'), edit_news_feed_path(news_feed) -%>
25
25
  <%= link_to t('page.destroy'), news_feed, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
26
26
  <%- end -%>
@@ -15,7 +15,7 @@
15
15
  <!--
16
16
  <div class="field">
17
17
  <%= f.label t('activerecord.models.user') -%><br />
18
- <%= link_to h(@news_post.user.username), user_path(@news_post.user.username) -%>
18
+ <%= link_to h(@news_post.user.username), @news_post.user -%>
19
19
  </div>
20
20
  <div class="field">
21
21
  <%= f.label t('role.required_role') -%>
@@ -22,7 +22,7 @@
22
22
  </td>
23
23
  <td><%= news_post.required_role.display_name.localize -%></td>
24
24
  <td>
25
- <% if can? :destroy, news_post %>
25
+ <% if can? :delete, news_post %>
26
26
  <%= link_to t('page.edit'), edit_news_post_path(news_post) -%>
27
27
  <%= link_to t('page.destroy'), news_post, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
28
28
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module EnjuNews
2
- VERSION = "0.1.0.pre2"
2
+ VERSION = "0.1.0.pre3"
3
3
  end