my_timeline 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 +7 -0
- data/.gitignore +10 -0
- data/Gemfile +6 -0
- data/Guardfile +17 -0
- data/LICENSE +20 -0
- data/README.markdown +65 -0
- data/Rakefile +37 -0
- data/app/assets/images/my_timeline/.gitkeep +0 -0
- data/app/assets/images/my_timeline/icons/notes.png +0 -0
- data/app/assets/javascripts/my_timeline/application.js +15 -0
- data/app/assets/stylesheets/my_timeline/application.css +13 -0
- data/app/controllers/my_timeline/application_controller.rb +19 -0
- data/app/controllers/my_timeline/control_panel_controller.rb +8 -0
- data/app/controllers/my_timeline/events_controller.rb +53 -0
- data/app/controllers/my_timeline/posts_controller.rb +26 -0
- data/app/helpers/my_timeline/application_helper.rb +4 -0
- data/app/helpers/my_timeline/events_helper.rb +7 -0
- data/app/models/my_timeline/event.rb +15 -0
- data/app/models/my_timeline/post.rb +13 -0
- data/app/presenters/my_timeline/event_presenter.rb +30 -0
- data/app/views/my_timeline/control_panel/index.html.erb +10 -0
- data/app/views/my_timeline/events/_day_with_events_list.html.erb +7 -0
- data/app/views/my_timeline/events/_day_with_events_table.html.erb +14 -0
- data/app/views/my_timeline/events/_event.html.erb +17 -0
- data/app/views/my_timeline/events/edit.html.erb +27 -0
- data/app/views/my_timeline/events/index.html.erb +11 -0
- data/app/views/my_timeline/posts/_form.html.erb +35 -0
- data/app/views/my_timeline/posts/new.html.erb +3 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20131027171920_create_my_timeline_events.rb +18 -0
- data/db/migrate/20131103000200_create_my_timeline_settings.rb +14 -0
- data/db/migrate/20131103135539_create_my_timeline_posts.rb +11 -0
- data/doc/screenshot.png +0 -0
- data/engine_plan.rb +13 -0
- data/lib/generators/my_timeline/install_generator.rb +18 -0
- data/lib/generators/templates/README +15 -0
- data/lib/generators/templates/my_timeline.rb +16 -0
- data/lib/my_timeline.rb +30 -0
- data/lib/my_timeline/engine.rb +23 -0
- data/lib/my_timeline/settings_ext.rb +24 -0
- data/lib/my_timeline/user_stub.rb +27 -0
- data/lib/my_timeline/version.rb +3 -0
- data/lib/tasks/my_timeline_tasks.rake +4 -0
- data/my_timeline.gemspec +28 -0
- data/script/rails +8 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +22 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/schema.rb +56 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/my_timeline_events.rb +7 -0
- data/spec/models/my_timeline/event_spec.rb +20 -0
- data/spec/spec_helper.rb +22 -0
- data/zeus.json +20 -0
- metadata +236 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= form_for @event do |f| %>
|
2
|
+
<% if @event.errors.any? %>
|
3
|
+
<div class="alert alert-error">
|
4
|
+
<h2><%= pluralize(@event.errors.count, "error") %> prohibited
|
5
|
+
this event from being saved:</h2>
|
6
|
+
<ul>
|
7
|
+
<% @event.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= f.label :happened_on, 'Happened On' %>
|
15
|
+
<%= f.text_field :happened_on %>
|
16
|
+
<br />
|
17
|
+
|
18
|
+
<%= f.label :description, 'Description' %>
|
19
|
+
<%= f.text_field :description %>
|
20
|
+
|
21
|
+
<%= f.label :public, 'Publically viewable' %>
|
22
|
+
<%= f.check_box :public %>
|
23
|
+
|
24
|
+
<br />
|
25
|
+
|
26
|
+
<%= f.submit %>
|
27
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1> Justin Aiken </h1><small>A demonstration timeline</small>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<% @dates_with_events.each do |day| %>
|
6
|
+
<h4><%= date_header_string day[:date] %></h4>
|
7
|
+
|
8
|
+
<%= render partial: "my_timeline/events/day_with_events_#{MyTimeline.render_method}", locals: {events: day[:events]} %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= paginate @events %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<%= form_for @post do |f| %>
|
2
|
+
<% if @post.errors.any? %>
|
3
|
+
<div class="alert alert-error">
|
4
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited
|
5
|
+
this post from being saved:</h2>
|
6
|
+
<ul>
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= f.label :happened_on, 'Happened On' %>
|
15
|
+
<%= f.datetime_select :happened_on, {prompt: { day: 'Select day', month: 'Select month', year: 'Select year' }}, {class: 'date-select'} %>
|
16
|
+
<br />
|
17
|
+
|
18
|
+
<%= f.fields_for :event do |ff| %>
|
19
|
+
<div>
|
20
|
+
<%= ff.label :description, 'Description' %>
|
21
|
+
<%= ff.text_field :description %>
|
22
|
+
|
23
|
+
<%= ff.label :public, 'Publically viewable' %>
|
24
|
+
<%= ff.check_box :public %>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<%= f.label :full_text, 'Text:' %>
|
29
|
+
<%= f.text_area :full_text %>
|
30
|
+
<br />
|
31
|
+
|
32
|
+
<br />
|
33
|
+
|
34
|
+
<%= f.submit %>
|
35
|
+
<% end %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateMyTimelineEvents < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :my_timeline_events do |t|
|
4
|
+
t.text :description
|
5
|
+
t.datetime :happened_on
|
6
|
+
t.string :icon_name
|
7
|
+
t.string :external_link
|
8
|
+
t.string :original_id
|
9
|
+
t.boolean :public, default: true
|
10
|
+
t.integer :importance, default: 5
|
11
|
+
|
12
|
+
t.references :user
|
13
|
+
t.references :linkable, :polymorphic => true
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateMyTimelineSettings < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
create_table :my_timeline_settings do |t|
|
5
|
+
t.string :var, :null => false
|
6
|
+
t.text :value
|
7
|
+
t.references :target, :null => false, :polymorphic => true
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index :my_timeline_settings, [ :target_type, :target_id, :var ], :unique => true
|
13
|
+
end
|
14
|
+
end
|
data/doc/screenshot.png
ADDED
Binary file
|
data/engine_plan.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'zeus/rails'
|
2
|
+
|
3
|
+
ROOT_PATH = File.expand_path(Dir.pwd)
|
4
|
+
ENV_PATH = File.expand_path('spec/dummy/config/environment', ROOT_PATH)
|
5
|
+
BOOT_PATH = File.expand_path('spec/dummy/config/boot', ROOT_PATH)
|
6
|
+
APP_PATH = File.expand_path('spec/dummy/config/application', ROOT_PATH)
|
7
|
+
ENGINE_ROOT = File.expand_path(Dir.pwd)
|
8
|
+
ENGINE_PATH = File.expand_path('lib/my_timeline/engine', ENGINE_ROOT)
|
9
|
+
|
10
|
+
class EnginePlan < Zeus::Rails
|
11
|
+
end
|
12
|
+
|
13
|
+
Zeus.plan = EnginePlan.new
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MyTimeline
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../../templates", __FILE__)
|
5
|
+
|
6
|
+
desc "Creates a MyTimeline initializer and copy locale files to your application."
|
7
|
+
class_option :orm
|
8
|
+
|
9
|
+
def copy_initializer
|
10
|
+
template "my_timeline.rb", "config/initializers/my_timeline.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
def show_readme
|
14
|
+
readme "README" if behavior == :invoke
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
Please add my_timeline to your routes file:
|
4
|
+
|
5
|
+
1. For a multiple-user instance:
|
6
|
+
|
7
|
+
resources :users do
|
8
|
+
mount MyTimeline::Engine => '/timeline', as: :my_timeline
|
9
|
+
end
|
10
|
+
|
11
|
+
2. For a single timeline:
|
12
|
+
|
13
|
+
mount MyTimeline::Engine => '/timeline', as: :my_timeline
|
14
|
+
|
15
|
+
===============================================================================
|
@@ -0,0 +1,16 @@
|
|
1
|
+
MyTimeline.setup do |config|
|
2
|
+
# The User class to use... Default is "User".
|
3
|
+
# Set to nil to not use per-user timelines,
|
4
|
+
# or put a constant in a string to use that class
|
5
|
+
config.user_class = 'User'
|
6
|
+
|
7
|
+
# By default, looks for the user by id, but if you want to use a name or a slug,
|
8
|
+
# set it here. I.E., config.user_slug = :nick_name would result in User.find_by_nick_name
|
9
|
+
#config.user_slug = :id
|
10
|
+
|
11
|
+
# How to render the events - in a :table, or in a :list
|
12
|
+
# config.render_method = :table
|
13
|
+
|
14
|
+
# What classes to style the table with
|
15
|
+
# config.table_class = "table table-striped"
|
16
|
+
end
|
data/lib/my_timeline.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'kaminari'
|
2
|
+
|
3
|
+
require "my_timeline/user_stub"
|
4
|
+
require "my_timeline/engine"
|
5
|
+
|
6
|
+
module MyTimeline
|
7
|
+
|
8
|
+
mattr_accessor :user_class, :user_slug, :render_method, :table_class, :config_object, :enabled_plugins
|
9
|
+
|
10
|
+
@@user_class = 'MyTimeline::UserStub'
|
11
|
+
def self.user_class
|
12
|
+
@@user_class.constantize
|
13
|
+
end
|
14
|
+
|
15
|
+
@@user_slug = :id
|
16
|
+
|
17
|
+
@@render_method = 'table'
|
18
|
+
@@use_bootstrap = true
|
19
|
+
|
20
|
+
@@table_class = "table table-striped"
|
21
|
+
|
22
|
+
@@enabled_plugins = []
|
23
|
+
def self.register_plugin(plugin_name)
|
24
|
+
@@enabled_plugins << plugin_name
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.setup
|
28
|
+
yield self
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'my_timeline/settings_ext'
|
2
|
+
|
3
|
+
module MyTimeline
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
include SettingsExt
|
6
|
+
|
7
|
+
isolate_namespace MyTimeline
|
8
|
+
|
9
|
+
config.autoload_paths << File.expand_path("../../app/classes/**", __FILE__)
|
10
|
+
config.autoload_paths << File.expand_path("../../app/scrapers/**", __FILE__)
|
11
|
+
|
12
|
+
config.generators do |g|
|
13
|
+
g.test_framework :rspec, fixture: false
|
14
|
+
g.fixture_replacement :factory_girl, dir: 'spec/factories'
|
15
|
+
g.assets false
|
16
|
+
g.helper false
|
17
|
+
end
|
18
|
+
|
19
|
+
config.after_initialize do |app|
|
20
|
+
extend_rails_settings
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rails-settings'
|
2
|
+
|
3
|
+
module MyTimeline
|
4
|
+
module SettingsExt
|
5
|
+
def extend_rails_settings
|
6
|
+
|
7
|
+
RailsSettings::SettingObject.class_eval do
|
8
|
+
self.table_name = "my_timeline_settings"
|
9
|
+
|
10
|
+
MyTimeline.config_object = ::RailsSettings::Configuration.new(MyTimeline.user_class) do |s|
|
11
|
+
s.key :empty_placeholder
|
12
|
+
end
|
13
|
+
|
14
|
+
MyTimeline.user_class.class_eval do
|
15
|
+
self.send :include, ::RailsSettings::Base
|
16
|
+
self.send :extend, ::RailsSettings::Scopes
|
17
|
+
|
18
|
+
MyTimeline.config_object.key :twitter, defaults: {foo: "bar"}
|
19
|
+
MyTimeline.config_object.key :github, defaults: {foo: "bar"}
|
20
|
+
end unless MyTimeline.user_class == MyTimeline::UserStub
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module MyTimeline
|
2
|
+
class UserStub
|
3
|
+
def self.events
|
4
|
+
Event
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.settings
|
8
|
+
RailsSettings::SettingObject
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.id
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.save!
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.method_missing(meth, *args, &blk)
|
20
|
+
if meth.to_s =~ /^find_by/
|
21
|
+
UserStub
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/my_timeline.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
require "my_timeline/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "my_timeline"
|
7
|
+
s.version = MyTimeline::VERSION
|
8
|
+
s.authors = ["Justin Aiken"]
|
9
|
+
s.email = ["60tonangel@gmail.com"]
|
10
|
+
s.homepage = "https://www.github.com/JustinAiken/my_timeline"
|
11
|
+
s.summary = "Social Media Aggregation Timeline"
|
12
|
+
s.description = "Social Media Aggregation Timeline"
|
13
|
+
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
18
|
+
|
19
|
+
s.add_runtime_dependency "rails"
|
20
|
+
s.add_runtime_dependency "kaminari"
|
21
|
+
s.add_runtime_dependency 'ledermann-rails-settings'
|
22
|
+
|
23
|
+
s.add_development_dependency 'sqlite3'
|
24
|
+
s.add_development_dependency 'rspec-rails'
|
25
|
+
s.add_development_dependency 'capybara'
|
26
|
+
s.add_development_dependency 'factory_girl_rails'
|
27
|
+
s.add_development_dependency 'guard-rspec'
|
28
|
+
end
|
data/script/rails
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/my_timeline/engine', __FILE__)
|
6
|
+
|
7
|
+
require 'rails/all'
|
8
|
+
require 'rails/engine/commands'
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,15 @@
|
|
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 vendor/assets/javascripts of plugins, if any, 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
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
File without changes
|
File without changes
|