tkh_mailing_list 0.0.1

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: 169bd0abefd6d59aeb9f1589dc1741e3ebcca843
4
+ data.tar.gz: fddc9b9fdee78e71ca90d57507dca963c936ec73
5
+ SHA512:
6
+ metadata.gz: 402fca7689de43cc64747a8a44efc5eb59c1b7ffcaf55ec1d0b725afee515d548989017d1fad20a651c0be33266806ac0506c60d59381d8be3c52876e5f5fbe1
7
+ data.tar.gz: a2993ad7bc15c5869deb8fc6e0abb8809c8dee7494d4b81d7a0dbf86d5c6565ca2a66540f611bb48fa78c19be6488bd1a3d35f1a2b6d42fe39c3c1c258a699f3
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
19
+ log/*.log
20
+ log/*.pid
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tkh_mailing_list.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Swami Atma
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # TkhMailingList
2
+
3
+ This mailing list module work with the tkh_authentication gem. It allows administrators to manage user records. Most of the functionality is yet to come.
4
+
5
+ Like all tkh gems, it's meant to be used for our projects at Ten Thousand Hours and is a part of the greater tkh\_cms gem. However if some issues or pull requests come in we are ready to extend the development efforts to help as many developers as possible.
6
+
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'tkh_mailing_list'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install tkh_mailing_list
21
+
22
+ ## Usage
23
+
24
+ To manage a record go to the /users folder.
25
+
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,41 @@
1
+ class DetailsController < ApplicationController
2
+
3
+ before_filter :authenticate
4
+ before_filter :authenticate_with_admin
5
+
6
+ def show
7
+ @detail = Detail.find(params[:id])
8
+ switch_to_admin_layout
9
+ end
10
+
11
+ def new
12
+ @detail = Detail.new
13
+ switch_to_admin_layout
14
+ end
15
+
16
+ def edit
17
+ @detail = Detail.find(params[:id])
18
+ switch_to_admin_layout
19
+ end
20
+
21
+ def create
22
+ @detail = Detail.new(params[:detail])
23
+ @detail.password = 'temporary'
24
+ @detail.password_confirmation = 'temporary'
25
+ if @detail.save
26
+ redirect_to @detail, notice: t('details.create.notice')
27
+ else
28
+ render action: "new", warning: t('details.create.warning'), layout: 'admin'
29
+ end
30
+ end
31
+
32
+ def update
33
+ @detail = Detail.find(params[:id])
34
+ if @detail.update_attributes(params[:detail])
35
+ redirect_to @detail, notice: t('details.update.notice')
36
+ else
37
+ render action: "edit", warning: t('details.update.warning'), layout: 'admin'
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,3 @@
1
+ class Detail < User
2
+ attr_accessible :admin, :teacher_status
3
+ end
@@ -0,0 +1,15 @@
1
+ <%= simple_form_for @detail, :html => { class: 'form-horizontal' } do |f| %>
2
+ <%= f.error_notification %>
3
+
4
+ <div class="form-inputs">
5
+ <%= f.input :first_name, label: t('activerecord.attributes.users.first_name') %>
6
+ <%= f.input :last_name, label: t('activerecord.attributes.users.last_name') %>
7
+ <%= f.input :other_name, label: t('activerecord.attributes.users.other_name'), hint: 'for example, spiritual name' %>
8
+ <%= f.input :email, label: t('activerecord.attributes.users.email') %>
9
+ </div>
10
+
11
+ <div class="form-actions">
12
+ <%= f.button :submit, :class => 'btn btn-primary' %>
13
+ </div>
14
+
15
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <ul class="nav nav-tabs" id="admin-menu-tab">
2
+ <%= content_tag :li, link_to(t('new'), new_detail_path), ({ class: 'active' } if controller.action_name.to_s == 'new' ) %>
3
+ <%= content_tag :li, link_to(t('list'), users_path), ({ class: 'active' } if controller.action_name.to_s == 'index' ) %>
4
+ <%= content_tag :li, link_to(t('view'), '#'), ({ class: 'active' }) if controller.action_name.to_s == 'show' %>
5
+ <%= content_tag :li, link_to(t('edit'), '#'), ({ class: 'active' }) if controller.action_name.to_s == 'edit' %>
6
+ </ul>
@@ -0,0 +1,6 @@
1
+ <h1><%= t('activerecord.models.users') %></h1>
2
+
3
+ <%= render 'details/tab_admin_menu' %>
4
+ <%= render 'form' %>
5
+
6
+ <%= render 'shared/admin_sidebar' %>
@@ -0,0 +1,6 @@
1
+ <h1><%= t('activerecord.models.users') %></h1>
2
+
3
+ <%= render 'details/tab_admin_menu' %>
4
+ <%= render 'form' %>
5
+
6
+ <%= render 'shared/admin_sidebar' %>
@@ -0,0 +1,14 @@
1
+ <h1><%= t('activerecord.models.users') %></h1>
2
+
3
+ <%= render 'details/tab_admin_menu' %>
4
+
5
+ <h1><%= @detail.name %></h1>
6
+
7
+ <p>Other name: <%= @detail.other_name %><br />
8
+ Email: <%= @detail.email %><br />
9
+ Admin: <%= @detail.admin? %><br />
10
+ Teacher: <%= @detail.teacher_status %>
11
+ </p>
12
+ <%= link_to t('edit'), edit_detail_path(@detail), class: 'btn btn-primary' %>
13
+
14
+ <%= render 'shared/admin_sidebar' %>
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
3
+ resources :details
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module TkhMailingList
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "tkh_mailing_list/version"
2
+
3
+ module TkhMailingList
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tkh_mailing_list/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tkh_mailing_list"
8
+ spec.version = TkhMailingList::VERSION
9
+ spec.authors = ["Swami Atma"]
10
+ spec.email = ["swami@TenThousandHours.eu"]
11
+ spec.description = %q{A mailing list module to work with tkh_authentication gem}
12
+ spec.summary = %q{This gem inherits from the tkh_authentication gem and allow administrators to manage user records}
13
+ spec.homepage = "https://github.com/allesklar/tkh_mailing_list"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency "tkh_authentication", '~> 0.1.8'
25
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tkh_mailing_list
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Swami Atma
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: tkh_authentication
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.8
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.8
55
+ description: A mailing list module to work with tkh_authentication gem
56
+ email:
57
+ - swami@TenThousandHours.eu
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - app/controllers/details_controller.rb
68
+ - app/models/detail.rb
69
+ - app/views/details/_form.html.erb
70
+ - app/views/details/_tab_admin_menu.html.erb
71
+ - app/views/details/edit.html.erb
72
+ - app/views/details/new.html.erb
73
+ - app/views/details/show.html.erb
74
+ - config/routes.rb
75
+ - lib/tkh_mailing_list.rb
76
+ - lib/tkh_mailing_list/version.rb
77
+ - tkh_mailing_list.gemspec
78
+ homepage: https://github.com/allesklar/tkh_mailing_list
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.0.3
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: This gem inherits from the tkh_authentication gem and allow administrators
102
+ to manage user records
103
+ test_files: []