webs 0.1.40 → 0.1.41

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('webs', '0.1.40') do |p|
6
+ Echoe.new('webs', '0.1.41') do |p|
7
7
  p.description = "Reusable webs stuff."
8
8
  p.url = "https://colczak@github.com/websdev/websgem.git"
9
9
  p.author = "Chuck Olczak"
@@ -0,0 +1,2 @@
1
+ dir = Pathname(__FILE__).dirname.expand_path
2
+ ActionController::Base.append_view_path( "#{dir}/../../views" )
@@ -0,0 +1,65 @@
1
+ # only needed until all apps have upgraded and converted to new permissions ( videos, blogs, forums )
2
+
3
+ module Webs
4
+ module Permission
5
+ DISABLED = -1
6
+ ANYONE = 0
7
+ LIMITED = 1
8
+ MEMBERS = 2
9
+ MODERATORS = 3
10
+ OWNER = 4
11
+ ADMIN = 5
12
+
13
+ # mappings to http://wiki.beta.freewebs.com/index.php/Fw:member-level-select
14
+ def webs_member_level_to_int member_level
15
+ {
16
+ 'anyone'=>Webs::Permission::ANYONE,
17
+ 'limited'=>Webs::Permission::LIMITED,
18
+ 'member'=>Webs::Permission::MEMBERS,
19
+ 'moderator'=>Webs::Permission::MODERATORS,
20
+ 'admin'=>Webs::Permission::ADMIN
21
+ }[member_level.downcase]
22
+ end
23
+
24
+ # mappings of the select value of fw:member-level-select to the old int vals
25
+ # TODO: convert data to new vals, don't have time right now
26
+ def webs_member_level_value_to_old_member_level webs_member_level
27
+ {
28
+ '-255'=>Webs::Permission::ANYONE,
29
+ '25'=>Webs::Permission::LIMITED,
30
+ '50'=>Webs::Permission::MEMBERS,
31
+ '75'=>Webs::Permission::MODERATORS,
32
+ '100'=>Webs::Permission::ADMIN,
33
+ '125'=>Webs::Permission::OWNER,
34
+ '255'=>Webs::Permission::DISABLED
35
+ }[webs_member_level]
36
+ end
37
+
38
+ def webs_int_to_member_level n
39
+ {
40
+ Webs::Permission::DISABLED=>'disabled',
41
+ Webs::Permission::ANYONE=>'anyone',
42
+ Webs::Permission::LIMITED=>'limited',
43
+ Webs::Permission::MEMBERS=>'member',
44
+ Webs::Permission::MODERATORS=>'moderator',
45
+ Webs::Permission::ADMIN=>'admin',
46
+ Webs::Permission::OWNER=>'admin'
47
+ }[n]
48
+ end
49
+
50
+ # converts level which is an int for the select options of a fw:member-level-select
51
+ # first to an associated Webs::Permission then to a blog member level
52
+ # TODO: This should be cleaned up and blogs should use the fw:member-level-select values
53
+ # the mapping is useful if you need to change the result, generally sending returning admin if owner
54
+ # since most of the apps use owner not admin
55
+ # The generally needs to be done in params since some objects contain validations
56
+ # example:
57
+ # convert_webs_member_level( params[:entries], :view_level, {Webs::Permission::ADMIN=>Webs::Permission::OWNER} )
58
+ # will take a webs member-level-select and convert it to a Webs::Permission mapping ADMIN to OWNER
59
+ def convert_webs_member_level h, key, mapping={}
60
+ return if h.nil?
61
+ v = webs_member_level_value_to_old_member_level( h[key] )
62
+ h[key] = mapping[v] || v
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,15 @@
1
+ <div class="fw-error">
2
+ <div class="errorExplanation" id="errorExplanation">
3
+ <% options ||= {:header_tag=>'h2'} %>
4
+ <% content_tag( options[:header_tag] ) do %>
5
+ <fw:intl>Please correct the following problems</fw:intl>:
6
+ <% end %>
7
+ <ul>
8
+ <% object.errors.full_messages.each do |msg| %>
9
+ <li><fw:intl><%= msg %></fw:intl></li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <br style="clear:both;">
14
+ </div>
15
+
@@ -0,0 +1,3 @@
1
+ <% if flash[:notice] %>
2
+ <div class="fw-flash"><fw:intl><%= flash[:notice] %></fw:intl></div>
3
+ <% end %>
data/lib/webs.rb CHANGED
@@ -7,7 +7,7 @@ require dir + 'helper/params'
7
7
  require dir + 'helper/tags'
8
8
 
9
9
  module Webs
10
- VERSION = '0.1.40'.freeze
10
+ VERSION = '0.1.41'.freeze
11
11
 
12
12
  def self.app_title
13
13
  APP_NAME.titleize
data/webs.gemspec CHANGED
@@ -2,34 +2,14 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{webs}
5
- s.version = "0.1.40"
5
+ s.version = "0.1.41"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Chuck Olczak"]
9
9
  s.date = %q{2011-06-08}
10
10
  s.description = %q{Reusable webs stuff.}
11
11
  s.email = %q{chuck@webs.com}
12
- gemfiles = [
13
- "README.rdoc",
14
- "lib/webs.rb",
15
- "lib/cache/cache.rb",
16
- "lib/config/webs_constants.rb",
17
- "lib/config/webs_initializer.rb",
18
- "lib/config/initializers/http_accept_patch.rb",
19
- "lib/controller/url_for_context_path.rb",
20
- "lib/controller/alive_controller.rb",
21
- "lib/controller/info_controller.rb",
22
- "lib/controller/webs_controller.rb",
23
- "lib/helper/application.rb",
24
- "lib/helper/params.rb",
25
- "lib/helper/tags.rb",
26
- "lib/middleware/parameter_fixer.rb",
27
- "lib/views/layouts/webs_page.html.erb",
28
- "lib/views/layouts/webs_utility.html.erb",
29
- "lib/test/webs_test_helper.rb",
30
- "lib/views/shared/_webs_info.html.erb",
31
- "lib/views/shared/_jquery_noconflict.html.erb",
32
- ]
12
+ gemfiles = Dir.glob( "**/*.{erb,rb,rdoc}" )
33
13
  s.extra_rdoc_files = gemfiles
34
14
  s.files = gemfiles + [ "Rakefile", "webs.gemspec" ]
35
15
  s.homepage = %q{http://github.com/websdotcom/websgem}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 75
4
+ hash: 73
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 40
10
- version: 0.1.40
9
+ - 41
10
+ version: 0.1.41
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chuck Olczak
@@ -26,45 +26,53 @@ executables: []
26
26
  extensions: []
27
27
 
28
28
  extra_rdoc_files:
29
- - README.rdoc
30
- - lib/webs.rb
29
+ - lib/views/layouts/webs_page.html.erb
30
+ - lib/views/layouts/webs_utility.html.erb
31
+ - lib/views/shared/_error_msgs.html.erb
32
+ - lib/views/shared/_flash_msg.html.erb
33
+ - lib/views/shared/_jquery_noconflict.html.erb
34
+ - lib/views/shared/_webs_info.html.erb
31
35
  - lib/cache/cache.rb
36
+ - lib/config/initializers/http_accept_patch.rb
37
+ - lib/config/initializers/webs_view_path.rb
32
38
  - lib/config/webs_constants.rb
33
39
  - lib/config/webs_initializer.rb
34
- - lib/config/initializers/http_accept_patch.rb
35
- - lib/controller/url_for_context_path.rb
36
40
  - lib/controller/alive_controller.rb
37
41
  - lib/controller/info_controller.rb
42
+ - lib/controller/permission_converter.rb
43
+ - lib/controller/url_for_context_path.rb
38
44
  - lib/controller/webs_controller.rb
39
45
  - lib/helper/application.rb
40
46
  - lib/helper/params.rb
41
47
  - lib/helper/tags.rb
42
48
  - lib/middleware/parameter_fixer.rb
49
+ - lib/test/webs_test_helper.rb
50
+ - lib/webs.rb
51
+ - README.rdoc
52
+ files:
43
53
  - lib/views/layouts/webs_page.html.erb
44
54
  - lib/views/layouts/webs_utility.html.erb
45
- - lib/test/webs_test_helper.rb
46
- - lib/views/shared/_webs_info.html.erb
55
+ - lib/views/shared/_error_msgs.html.erb
56
+ - lib/views/shared/_flash_msg.html.erb
47
57
  - lib/views/shared/_jquery_noconflict.html.erb
48
- files:
49
- - README.rdoc
50
- - lib/webs.rb
58
+ - lib/views/shared/_webs_info.html.erb
51
59
  - lib/cache/cache.rb
60
+ - lib/config/initializers/http_accept_patch.rb
61
+ - lib/config/initializers/webs_view_path.rb
52
62
  - lib/config/webs_constants.rb
53
63
  - lib/config/webs_initializer.rb
54
- - lib/config/initializers/http_accept_patch.rb
55
- - lib/controller/url_for_context_path.rb
56
64
  - lib/controller/alive_controller.rb
57
65
  - lib/controller/info_controller.rb
66
+ - lib/controller/permission_converter.rb
67
+ - lib/controller/url_for_context_path.rb
58
68
  - lib/controller/webs_controller.rb
59
69
  - lib/helper/application.rb
60
70
  - lib/helper/params.rb
61
71
  - lib/helper/tags.rb
62
72
  - lib/middleware/parameter_fixer.rb
63
- - lib/views/layouts/webs_page.html.erb
64
- - lib/views/layouts/webs_utility.html.erb
65
73
  - lib/test/webs_test_helper.rb
66
- - lib/views/shared/_webs_info.html.erb
67
- - lib/views/shared/_jquery_noconflict.html.erb
74
+ - lib/webs.rb
75
+ - README.rdoc
68
76
  - Rakefile
69
77
  - webs.gemspec
70
78
  has_rdoc: true