adva-blog 0.0.1 → 0.0.2

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.
@@ -2,8 +2,10 @@ class Admin::BlogsController < Admin::SectionsController
2
2
  purges :create, :update, :destroy
3
3
 
4
4
  def show
5
- # TODO needs to be here because the admin top section drop down menu links to section#show.
6
- # might want to invent a concept of default_action for a section type or something else.
5
+ # TODO need to do an internal redirect here because the admin top section drop down menu
6
+ # links to section#show. Might want to invent a concept of default_action for a section
7
+ # type. Also might want to invent a :preserve_flash => true concept or something like that
8
+ # when redirecting through http (which otherwise looses the flash after, e.g. blog#create)
7
9
  internal_redirect_to 'admin/posts#index', params.merge(:blog_id => params.delete(:id))
8
10
  end
9
11
  end
@@ -1,32 +1,25 @@
1
- class Admin::Blogs::Menu < Adva::View::Menu::Admin::Actions
1
+ require_dependency 'admin/sections/_menu.html'
2
+
3
+ class Admin::Blogs::Menu < Admin::Sections::Menu
2
4
  include do
3
5
  def main
4
- if persisted?
5
- label(resource.name)
6
- item(:'.show', index_path(:posts))
7
- item(:'.edit', edit_path)
8
- item(:'.categories', index_path(:categories)) if Adva.engine?(:categories)
9
- else
10
- item(:'.sections', index_path)
11
- end
6
+ super
7
+ categories if persisted? && Adva.engine?(:categories)
12
8
  end
13
9
 
14
10
  def right
15
- if persisted?
16
- item(:'.new_item', new_path(:post))
17
- item(:'.destroy', resource_path, :method => :delete, :confirm => t(:'.confirm_destroy', :model_name => resource.class.model_name.human))
18
- else
19
- item(:'.new', new_path)
20
- end
11
+ new_item if persisted?
12
+ super
21
13
  end
22
14
 
23
15
  protected
24
16
 
25
- def active?(url, options)
26
- # hmmm ...
27
- types = Section.types.map { |type| type.underscore.pluralize }.join('|')
28
- return false if url =~ %r(/admin/sites/\d+/#{types}/\d+$) && request.path != url
29
- super
17
+ def show
18
+ item(:'.posts', index_path(:posts))
19
+ end
20
+
21
+ def new_item
22
+ item(:'.new_post', new_path(:post))
30
23
  end
31
24
  end
32
25
  end
@@ -0,0 +1,22 @@
1
+ require_dependency 'admin/categories/_menu.html'
2
+
3
+ Admin::Categories::Menu.class_eval do
4
+ include do
5
+ def main
6
+ super
7
+ posts if blog?
8
+ end
9
+
10
+ protected
11
+
12
+ def posts
13
+ item(:'.posts', index_parent_path(:posts), :before => :'.categories')
14
+ end
15
+
16
+ def blog?
17
+ resource.section.is_a?(Blog)
18
+ end
19
+ end
20
+ end
21
+
22
+
@@ -1,18 +1,10 @@
1
- class Admin::Posts::Menu < Adva::View::Menu::Admin::Actions
1
+ require_dependency 'admin/contents/_menu.html'
2
+
3
+ class Admin::Posts::Menu < Admin::Contents::Menu
2
4
  include do
3
5
  def main
4
- label(resource.section.name)
5
- item(:'.show', index_path)
6
- item(:'.edit_parent', edit_parent_path)
7
- end
8
-
9
- def right
10
- item(:'.new', new_path)
11
- if persisted?
12
- item(:'.view', public_url)
13
- item(:'.edit', edit_path)
14
- item(:'.destroy', resource_path, :method => :delete, :confirm => t(:'.confirm_destroy', :model_name => resource.class.model_name.human))
15
- end
6
+ super
7
+ categories(index_parent_path(:categories), :before => :'.edit_section') if Adva.engine?(:categories)
16
8
  end
17
9
  end
18
10
  end
@@ -31,11 +31,11 @@ class Admin::Posts::Index < Minimal::Template
31
31
  end
32
32
 
33
33
  def link_to_view(post)
34
- capture { link_to(options[:text] || :'.view', public_url_for([blog, post]), :class => :view) }
34
+ capture { link_to(options[:text] || :'.actions.view', public_url_for([blog, post]), :class => :view) }
35
35
  end
36
36
 
37
37
  def status(post)
38
- capture { span(t(:'.published'), :title => t(:'.published'), :class => 'status published') }
38
+ capture { span(t(:'.status.published'), :title => t(:'.status.published'), :class => 'status published') }
39
39
  end
40
40
  end
41
41
  end
@@ -2,58 +2,37 @@ en:
2
2
  time:
3
3
  formats:
4
4
  post: "%a, %d %b %Y"
5
+
5
6
  section:
6
7
  types:
7
8
  blog: Blog
8
- layouts:
9
- blog:
10
- made_with: "Made with <a href=\"http://github.com/svenfuchs/adva-cms2\">adva cms 2</a>"
11
- feed: Atom Feed
9
+
10
+ menu:
11
+ posts: Posts
12
+ new_post: New Post
13
+
14
+ columns:
15
+ post: Post
16
+ comments: Comments
17
+
12
18
  posts:
13
19
  index:
14
20
  continue: Read the rest of this post
15
21
  meta:
16
22
  info: "posted on %{date}"
17
- columns:
18
- post: Post
19
- comments: Comments
20
- published: Published
21
- author: Author
22
- actions: ""
23
+
23
24
  admin:
24
25
  blogs:
25
26
  new:
26
27
  title: Create a New Section
27
28
  edit:
28
29
  title: Settings
29
- menu:
30
- sections: Sections
31
- categories: Categories
32
- show: Posts
33
- new: New
34
- edit: Settings
35
- destroy: Delete
36
- new_item: New Post
37
- confirm_destroy: "Do you really want to delete this %{model_name}?"
38
30
  posts:
39
31
  index:
40
- view: View
41
- edit: Edit
42
- destroy: Delete
43
- published: Published
44
32
  empty: "There are no posts. %{link}"
45
33
  create_item: "Create one now &raquo;"
46
- confirm_destroy: "Do you really want to delete this %{model_name}?"
47
34
  new:
48
35
  title: Write a new blog post
49
36
  edit:
50
37
  title: Edit Post
51
38
  delete: Delete
52
- menu:
53
- show: Posts
54
- edit_parent: Settings
55
- new: New Post
56
- view: View
57
- edit: Edit
58
- destroy: Delete
59
- confirm_destroy: "Do you really want to delete this %{model_name}?"
data/config/redirects.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  Adva::Registry.set :redirect, {
2
+ # see comment in admin/blog_controller
3
+ # 'admin/blogs#show' => lambda { |c| c.index_path(:posts) },
2
4
  'admin/blogs#update' => lambda { |c| c.edit_url },
3
5
  'admin/posts#create' => lambda { |c| c.edit_url },
4
6
  'admin/posts#update' => lambda { |c| c.edit_url },
@@ -0,0 +1,3 @@
1
+ module AdvaBlog
2
+ VERSION = "0.0.2"
3
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva-blog
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ingo Weiss
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-29 00:00:00 +02:00
19
+ date: 2010-11-08 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: "0"
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
- description: "[description]"
50
+ description: Blog engine for adva-cms2
51
51
  email: nobody@adva-cms.org
52
52
  executables: []
53
53
 
@@ -59,6 +59,7 @@ files:
59
59
  - app/controllers/posts_controller.rb
60
60
  - app/controllers/admin/blogs_controller.rb
61
61
  - app/controllers/admin/posts_controller.rb
62
+ - app/views/admin/categories/_menu_slice.html.rb
62
63
  - app/views/admin/blogs/show.html.rb
63
64
  - app/views/admin/blogs/edit.html.rb
64
65
  - app/views/admin/blogs/new.html.rb
@@ -78,6 +79,7 @@ files:
78
79
  - config/redirects.rb
79
80
  - config/routes.rb
80
81
  - config/locales/en.yml
82
+ - lib/adva_blog/version.rb
81
83
  - lib/adva/blog.rb
82
84
  - lib/testing/factories.rb
83
85
  - lib/testing/paths.rb
@@ -116,6 +118,6 @@ rubyforge_project: "[none]"
116
118
  rubygems_version: 1.3.7
117
119
  signing_key:
118
120
  specification_version: 3
119
- summary: "[summary]"
121
+ summary: Blog engine for adva-cms2
120
122
  test_files: []
121
123