mix-rails-writer 0.10.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.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Writer
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Writer'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
File without changes
@@ -0,0 +1,3 @@
1
+ class Admix::NewsController < Admix::PostsController
2
+ defaults :resource_class => News
3
+ end
@@ -0,0 +1,3 @@
1
+ class Admix::PostsController < Admix::InheritedController
2
+
3
+ end
@@ -0,0 +1,13 @@
1
+ class NewsController < PostsController
2
+
3
+
4
+ def index
5
+ @news = News.published.desc(:date).paginate(per_page: 10)
6
+ end
7
+
8
+ def show
9
+ @news = News.find(params[:id])
10
+ @other_news = News.published.not_in(:id => @news.id).desc(:date).paginate(per_page: 10)
11
+ end
12
+
13
+ end
@@ -0,0 +1,3 @@
1
+ class PostsController < ApplicationController
2
+
3
+ end
@@ -0,0 +1,38 @@
1
+ class Admix::NewsDatagrid
2
+
3
+ include Datagrid
4
+
5
+
6
+ scope do
7
+ News.desc(:date)
8
+ end
9
+
10
+ filter :date do |value|
11
+ value.to_s(:created_at)
12
+ end
13
+
14
+ column :title, header: I18n.t('posts.title')
15
+ column :date, header: I18n.t('posts.date') do |post|
16
+ post.date.strftime("%d/%m/%Y") #post.date.to_s(:created_at)
17
+ end
18
+
19
+ column :image, header: I18n.t('posts.image'), html: true do |post|
20
+ if post.image?
21
+ image_tag post.image.url(:small_thumb)
22
+ else
23
+ "--"
24
+ end
25
+ end
26
+
27
+ column :published, header: I18n.t('posts.published') do |post|
28
+ if post.published
29
+ I18n.t("posts.published_yes")
30
+ else
31
+ I18n.t("posts.published_no")
32
+ end
33
+ end
34
+
35
+
36
+ include Admix::TableActions
37
+
38
+ end
@@ -0,0 +1,3 @@
1
+ class News < Post
2
+
3
+ end
@@ -0,0 +1,26 @@
1
+ class Post
2
+
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+ include Mongoid::Paranoia
6
+ include Mongoid::Slug
7
+
8
+ field :title, type: String
9
+ field :text, type: String
10
+ field :source, type: String
11
+ field :date, type: DateTime
12
+ field :published, type: Boolean, default: true
13
+
14
+
15
+ validates_presence_of :title
16
+ validates_presence_of :date
17
+
18
+ slug :title, history: true do |current_object|
19
+ current_object.title.parameterize
20
+ end
21
+
22
+ scope :published, where(published: true)
23
+
24
+ mount_uploader :image, Writer::ImageUploader
25
+
26
+ end
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+ require 'carrierwave/processing/mini_magick'
3
+
4
+ class Writer::ImageUploader < CarrierWave::Uploader::Base
5
+
6
+ # Include RMagick or MiniMagick support:
7
+ # include CarrierWave::RMagick
8
+ include CarrierWave::MiniMagick
9
+
10
+ # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
11
+ include Sprockets::Helpers::RailsHelper
12
+ include Sprockets::Helpers::IsolatedHelper
13
+
14
+ # Choose what kind of storage to use for this uploader:
15
+ storage :grid_fs
16
+ # storage :fog
17
+
18
+ # Override the directory where uploaded files will be stored.
19
+ # This is a sensible default for uploaders that are meant to be mounted:
20
+ def store_dir
21
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
22
+ end
23
+
24
+ # Provide a default URL as a default if there hasn't been a file uploaded:
25
+ # def default_url
26
+ # # For Rails 3.1+ asset pipeline compatibility:
27
+ # # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
28
+ #
29
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
30
+ # end
31
+
32
+ # Process files as they are uploaded:
33
+ # process :scale => [200, 300]
34
+ #
35
+ # def scale(width, height)
36
+ # # do something
37
+ # end
38
+
39
+ # Create different versions of your uploaded files:
40
+ # version :thumb do
41
+ # process :resize_to_fit => [80, 80]
42
+ # end
43
+
44
+ version :medium do
45
+ process :resize_to_fill => [640,420]
46
+ end
47
+
48
+ version :thumb do
49
+ process :resize_to_fill => [190,143]
50
+ end
51
+
52
+ version :small_thumb do
53
+ process :resize_to_fill => [82,62]
54
+ end
55
+
56
+ # Add a white list of extensions which are allowed to be uploaded.
57
+ # For images you might use something like this:
58
+ # def extension_white_list
59
+ # %w(jpg jpeg gif png)
60
+ # end
61
+
62
+ # Override the filename of the uploaded files:
63
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
64
+ # def filename
65
+ # "something.jpg" if original_filename
66
+ # end
67
+
68
+ end
@@ -0,0 +1,6 @@
1
+ = f.input :title, as: 'string'
2
+ = f.input :text, as: 'richtext'
3
+ = f.input :date, as: 'datepicker'
4
+ = f.input :source, as: 'string'
5
+ = f.input :image, as: 'file'
6
+ = f.input :published, as: 'boolean'
@@ -0,0 +1,9 @@
1
+ %dl
2
+ %dt= t('posts.title')
3
+ %dd= resource.title
4
+ %dt= t('posts.date')
5
+ %dd= resource.date.strftime("%d/%m/%Y")
6
+ %dt= t('posts.text')
7
+ %dd= raw resource.text
8
+ %dt= t('posts.source')
9
+ %dd= resource.source
@@ -0,0 +1,3 @@
1
+ = link_to image_tag('admix/zoom.png'), resource_url(resource), class: 'btn', title:'Visualizar registro'
2
+ = link_to image_tag('admix/page_edit.png'), edit_resource_url(resource), class: 'btn', title:'Editar registro'
3
+ = link_to image_tag('admix/cancel.png'), resource_url(resource), method: :delete, data: { confirm: t('admix.crud.destroy_confirm') }, class: 'btn', title:'Deletar registro'
File without changes
@@ -0,0 +1,2 @@
1
+ - if content_for?(:news_content)
2
+ = content_for(:news_content)
@@ -0,0 +1,20 @@
1
+ pt-BR:
2
+ resources:
3
+ news: 'noticias'
4
+ will_paginate:
5
+ previous_label: "<< anterior"
6
+ next_label: "próximo >>"
7
+ posts:
8
+ published_yes: "Sim"
9
+ published_no: "Não"
10
+ posts: 'Postagens'
11
+ post: 'Postagem'
12
+ title: 'Nome'
13
+ date: 'Data'
14
+ text: 'Texto'
15
+ published: 'Publicado?'
16
+ source: 'Fonte'
17
+ image: 'Imagem'
18
+ news:
19
+ news: 'Notícias'
20
+ new: 'Notícia'
data/config/routes.rb ADDED
@@ -0,0 +1,19 @@
1
+ Rails.application.routes.draw do
2
+
3
+ localized do
4
+ resources :news
5
+ end
6
+
7
+
8
+ resources :blogs do
9
+ resources :posts
10
+ end
11
+
12
+ namespace :admix do
13
+ resources :news
14
+ resources :blogs do
15
+ resources :posts
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,4 @@
1
+ require "mix-rails-writer/engine"
2
+
3
+ module MixRailsWriter
4
+ end
@@ -0,0 +1,19 @@
1
+ module MixRailsWriter
2
+ class Engine < ::Rails::Engine
3
+
4
+ def navigation
5
+ if defined? Admix
6
+ Admix::Navigation::NavBar.post_menu do
7
+ Admix::Navigation::NavBar.find(:content) do |menu|
8
+ menu.submenu do |submenu|
9
+ submenu.key = :news
10
+ submenu.title = I18n.t 'news.news'
11
+ submenu.url = 'admix_news_index_url'
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ module MixRailsWriter
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 10
5
+ TINY = 2
6
+ PRE = nil
7
+
8
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :writer do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mix-rails-writer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.10.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sadjow Leão
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.11
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.11
30
+ description: Mix Writer is a group of models, views, controllers for rails applications
31
+ that added News, Blogs, Articles funcionality.
32
+ email:
33
+ - sadjow@gmail.com
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - app/uploaders/writer/image_uploader.rb
39
+ - app/controllers/admix/posts_controller.rb
40
+ - app/controllers/admix/news_controller.rb
41
+ - app/controllers/posts_controller.rb
42
+ - app/controllers/news_controller.rb
43
+ - app/assets/stylesheets/writer/posts/index.scss
44
+ - app/models/admix/news_datagrid.rb
45
+ - app/models/post.rb
46
+ - app/models/news.rb
47
+ - app/views/admix/posts/_show.html.haml
48
+ - app/views/admix/posts/_thumb_image.html.haml
49
+ - app/views/admix/posts/_table_actions.html.haml
50
+ - app/views/admix/posts/_form_fields.html.haml
51
+ - app/views/templates/news/index.html.haml
52
+ - config/locales/writer.pt-BR.yml
53
+ - config/routes.rb
54
+ - lib/tasks/writer_tasks.rake
55
+ - lib/mix-rails-writer/version.rb
56
+ - lib/mix-rails-writer/engine.rb
57
+ - lib/mix-rails-writer.rb
58
+ - MIT-LICENSE
59
+ - Rakefile
60
+ - README.rdoc
61
+ homepage: https://github.com/mixinternet/mix-writer
62
+ licenses: []
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ segments:
74
+ - 0
75
+ hash: -1630285607343578651
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ segments:
83
+ - 0
84
+ hash: -1630285607343578651
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.24
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Mix Writer is a group of models, views, controllers for rails applications
91
+ that added News, Blogs, Articles funcionality.
92
+ test_files: []