beef-admin_area 0.1.4 → 0.1.6

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.4
1
+ 0.1.6
data/admin_area.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{admin_area}
5
- s.version = "0.1.4"
5
+ s.version = "0.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Steve England"]
9
- s.date = %q{2009-08-26}
9
+ s.date = %q{2009-09-07}
10
10
  s.email = %q{steve@wearebeef.co.uk}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -1,33 +1,18 @@
1
1
  class Admin::SettingsController < Admin::BaseController
2
2
 
3
- # rescue_from Flickr::APIError, :with => :flickr_error
4
-
5
3
  def show
6
4
  unless current_user.admin?
7
5
  flash.now[:notice] = 'You may view settings but editing is only available to Adminstrators.'
8
6
  end
9
-
10
7
  @settings = Settings
11
-
12
- # unless Settings.flickr_api_key.blank? or Settings.flickr_api_secret.blank?
13
- # Flickr::API.connect Settings.flickr_api_key, Settings.flickr_api_secret, Settings.flickr_auth_token
14
- # if @unauthorised = Flickr::API.unauthorised?
15
- # @login_url = Flickr::API.login_url
16
- # end
17
- # end
18
8
  end
19
9
 
20
10
  def update
21
11
  unless current_user.admin?
22
12
  flash[:notice] = 'You may view settings but editing is only available to Adminstrators.'
23
13
  else
24
-
25
14
  params[:settings].each_pair do |key,value|
26
- if(key =~ /(_api_key|_api_secret)/i)
27
- value.strip!
28
- end
29
-
30
- Settings[key] = value.gsub(/^http\:\/\//i,'')
15
+ Settings[key] = value.strip
31
16
  end
32
17
 
33
18
  flash.now[:notice] = "Setting#{params[:settings].length>1?'s':''} #{params[:settings].collect{|s,v| s.humanize}.join(', ')} was successfully updated."
@@ -37,7 +22,6 @@ class Admin::SettingsController < Admin::BaseController
37
22
  format.html { redirect_to admin_setting_path}
38
23
  format.js
39
24
  end
40
-
41
25
  end
42
26
 
43
27
  end
@@ -33,24 +33,6 @@ module Admin::BaseHelper
33
33
  page << 'init_flash_messages();'
34
34
  end
35
35
 
36
- def lastest_flickr
37
- return if Settings.flickr_api_key.blank? or Settings.flickr_user_id.blank?
38
- Flickr::API.connect Settings.flickr_api_key, Settings.flickr_api_secret, Settings.flickr_auth_token
39
- flickr_params = { :per_page => '5', :page => params[:page], :user_id => Settings.flickr_user_id, :sort => 'date-taken-desc', :tag_mode => 'all' }
40
- flickr_params[:tags] = params[:tags] unless params[:tags].blank?
41
- flickr_result = Flickr::Photo.find(:all, flickr_params)
42
- render :partial => 'admin/shared/flickr_latest.html.erb', :locals => { :flickr_images => flickr_result }
43
- end
44
-
45
- def flickr_select
46
- return if Settings.flickr_api_key.blank? or Settings.flickr_user_id.blank?
47
- Flickr::API.connect Settings.flickr_api_key, Settings.flickr_api_secret, Settings.flickr_auth_token
48
- flickr_params = { :per_page => '12', :page => params[:page], :user_id => Settings.flickr_user_id, :sort => 'date-taken-desc', :tag_mode => 'all' }
49
- flickr_params[:tags] = params[:tags] unless params[:tags].blank?
50
- flickr_result = Flickr::Photo.find(:all, flickr_params)
51
- render :partial => 'admin/shared/flickr.html.erb', :locals => { :flickr_images => flickr_result }
52
- end
53
-
54
36
  def preview_link(object)
55
37
  url = url_for([:preview, :admin, object ])
56
38
  link_to_function 'Preview', "new Ajax.Updater('page_preview', '#{url}', {asynchronous:true, evalScripts:true, parameters: this.up('form').serialize() + '&assets=' + getAssetIDs('asset-list')})", :class => 'button'
data/config/routes.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
2
  map.admin 'admin', :controller => 'admin/base'
3
3
  map.namespace(:admin) do |admin|
4
- admin.flickr 'flickr', :controller => 'base', :action => 'flickr'
5
4
  admin.resource :settings
6
5
  admin.resources :users
7
6
  end
@@ -12,6 +12,13 @@ class AdminAreaFilesGenerator < Rails::Generator::Base
12
12
 
13
13
  attr_accessible :name
14
14
  validates_presence_of :name
15
+
16
+ private
17
+ before_save :set_permalink
18
+
19
+ def set_permalink
20
+ self.permalink = name.parameterize
21
+ end
15
22
  RUBY
16
23
 
17
24
 
@@ -23,12 +23,7 @@
23
23
  </fieldset>
24
24
 
25
25
  <fieldset id="flickrsettings"><legend>Flickr Settings</legend>
26
- <% if @unauthorised %>
27
- <p>You are currently unauthorised because <%= @unauthorised %>, please <%= link_to 'login to flickr', @login_url %>
28
- <% end -%>
29
- <%= setting_form [['flickr_user_id','text'],
30
- ['flickr_api_key','text'],
31
- ['flickr_api_secret','text']] %>
26
+ <%= setting_form :flickr_user_id %>
32
27
  </fieldset>
33
28
 
34
29
 
@@ -8,6 +8,7 @@ class CreateSettingsAndUsers < ActiveRecord::Migration
8
8
 
9
9
  change_table(:users) do |t|
10
10
  t.string :name, :limit => 128
11
+ t.string :permalink, :limit => 128
11
12
  t.string :role, :limit => 10
12
13
  end
13
14
  end
@@ -721,11 +721,6 @@ a.right {
721
721
  color: #ddd;
722
722
  }
723
723
 
724
- #flickr-select img {
725
- margin: 2px;
726
- border: 1px solid #666;
727
- }
728
-
729
724
  /* so:preview-text */
730
725
 
731
726
  .preview-area p {
@@ -1,7 +1,7 @@
1
- <h1>Listing <%= plural_name %></h1>
1
+ <h1>Listing <%= plural_name.titleize %></h1>
2
2
 
3
3
  <ul class="choices">
4
- <li><%%= link_to 'New <%= singular_name %>', new_admin_<%= singular_name %>_path %></li>
4
+ <li><%%= link_to 'New <%= singular_name.titleize %>', new_admin_<%= singular_name %>_path %></li>
5
5
  </ul>
6
6
 
7
7
  <table>
@@ -10,8 +10,8 @@
10
10
  <% for attribute in attributes -%>
11
11
  <%%= sortable_table_header :name => "<%= attribute.column.human_name %>", :sort => "<%= attribute.name %>" %>
12
12
  <% end -%>
13
+ <th colspan="2">Actions</th>
13
14
  </tr>
14
- <th colspan="2">Actions</th>
15
15
  </thead>
16
16
  <tbody>
17
17
  <%% @<%= plural_name %>.each do |<%= singular_name %>| %>
@@ -33,6 +33,7 @@
33
33
  <% for attribute in attributes -%>
34
34
  <%%= sortable_table_header :name => "<%= attribute.column.human_name %>", :sort => "<%= attribute.name %>" %>
35
35
  <% end -%>
36
+ <th colspan="2">Actions</th>
36
37
  </tr>
37
38
  </tfoot>
38
39
  </table>
@@ -1,4 +1,4 @@
1
- <h1><%%= @<%= singular_name %>.new_record? ? 'New' : 'Editing' %> <%= singular_name %></h1>
1
+ <h1><%%= @<%= singular_name %>.new_record? ? 'New' : 'Editing' %> <%= singular_name.titleize %></h1>
2
2
 
3
3
  <%% form_for([:admin, @<%= singular_name %>]) do |f| %>
4
4
  <%%= f.error_messages %>
@@ -1,4 +1,4 @@
1
- <h1>Listing <%= plural_name %></h1>
1
+ <h1>Listing <%= plural_name.titleize %></h1>
2
2
 
3
3
  <table>
4
4
  <tr>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beef-admin_area
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve England
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-26 00:00:00 -07:00
12
+ date: 2009-09-07 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -182,6 +182,7 @@ files:
182
182
  - test/test_helper.rb
183
183
  has_rdoc: false
184
184
  homepage: http://github.com/beef/admin
185
+ licenses:
185
186
  post_install_message:
186
187
  rdoc_options:
187
188
  - --charset=UTF-8
@@ -202,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
203
  requirements: []
203
204
 
204
205
  rubyforge_project:
205
- rubygems_version: 1.2.0
206
+ rubygems_version: 1.3.5
206
207
  signing_key:
207
208
  specification_version: 3
208
209
  summary: Rails engine that provides a standard admin area with user managament