simple_options 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 90de45199c46105af69c8bd70e5f9628baa91d1d
4
+ data.tar.gz: 9bff5afc019362069394b8fd5fe811ad3b78ec76
5
+ SHA512:
6
+ metadata.gz: 2dda5cf3d8a32a7cae424f9a7a2a2af9366a3b6e2733b8d757687c64552cef74e2699fa0deebfdc2c21141da2b9c97ecb2a3c5a503725c2dc287c4ba7005b840
7
+ data.tar.gz: 7ec3a81c2bbf2e2cada6488500e2177ba5941f716c5066d1fc3ef95b58505fb72b8791b926a48c7edcf4d8585f01c6ffaad7e56a8a86288dcb8e9043bf9ae95e
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Max Ivak
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.
@@ -0,0 +1,26 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'SimpleOptions'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module SimpleOptions
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module SimpleOptions
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,17 @@
1
+ module OptionConcern
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+
6
+ end
7
+
8
+ module ClassMethods
9
+ # will be overridden in the main app
10
+ #def my_class_method
11
+ # []
12
+ #end
13
+
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,23 @@
1
+ class Option < ActiveRecord::Base
2
+
3
+ ### search
4
+ paginates_per 10
5
+
6
+ ### search
7
+ searchable_by_simple_filter
8
+
9
+ #
10
+ include OptionConcern
11
+
12
+ #
13
+ def self.get(name, v_def=nil)
14
+ row = where("name = ?", name).first
15
+ return v_def if row.nil?
16
+
17
+ row.value
18
+ end
19
+
20
+ def self.set(name, v)
21
+ n = where("name = ?", name).update_all(:value => v)
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>SimpleOptions</title>
5
+ <%= stylesheet_link_tag "simple_options/application", media: "all" %>
6
+ <%= javascript_include_tag "simple_options/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,2 @@
1
+ SimpleOptions::Engine.routes.draw do
2
+ end
@@ -0,0 +1,28 @@
1
+ #require 'active_support/concern'
2
+ require 'rails/generators/migration'
3
+ #require 'rails/generators/actions/create_migration'
4
+
5
+
6
+ module OptimacmsOptions
7
+ module Generators
8
+ class InstallGenerator < ::Rails::Generators::Base
9
+ include Rails::Generators::Migration
10
+ source_root File.expand_path('../templates', __FILE__)
11
+ desc "add the migrations"
12
+
13
+ def self.next_migration_number(path)
14
+ unless @prev_migration_nr
15
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
16
+ else
17
+ @prev_migration_nr += 1
18
+ end
19
+ @prev_migration_nr.to_s
20
+ end
21
+
22
+ def copy_migrations
23
+ migration_template "migration.rb", "db/migrate/optimacms_options.rb"
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,16 @@
1
+ class OptimacmsOptionsCreate < ActiveRecord::Migration
2
+ def change
3
+ create_table :options do |t|
4
+ t.string :name, :null => false
5
+ t.string :title, :null => false
6
+ t.string :title, :null => false
7
+ t.text :description, :null => true
8
+ t.boolean :is_changed, :null => true, :default=>1
9
+ t.string :category, :null => true
10
+ t.string :value, :null => true
11
+
12
+ end
13
+
14
+ add_index :options, :name, :unique => true
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ require "simple_options/engine"
2
+
3
+ module SimpleOptions
4
+ end
@@ -0,0 +1,10 @@
1
+ module SimpleOptions
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace SimpleOptions
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module SimpleOptions
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :simple_options do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple_options
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Max Ivak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
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
+ description: Edit settings (options)
42
+ email:
43
+ - maxivak@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - MIT-LICENSE
49
+ - Rakefile
50
+ - app/assets/javascripts/simple_options/application.js
51
+ - app/assets/stylesheets/simple_options/application.css
52
+ - app/controllers/simple_options/application_controller.rb
53
+ - app/helpers/simple_options/application_helper.rb
54
+ - app/models/concerns/option_concern.rb
55
+ - app/models/option.rb
56
+ - app/views/layouts/simple_options/application.html.erb
57
+ - config/routes.rb
58
+ - lib/generators/optimacms_options/install/install_generator.rb
59
+ - lib/generators/optimacms_options/install/templates/migration.rb
60
+ - lib/simple_options.rb
61
+ - lib/simple_options/engine.rb
62
+ - lib/simple_options/version.rb
63
+ - lib/tasks/simple_options_tasks.rake
64
+ homepage: https://github.com/maxivak/simple_options
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.4.8
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Edit settings of the application
88
+ test_files: []