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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 714fab9ec169033025ebe673cbb873a04af8e902
|
4
|
+
data.tar.gz: e5e3274ed45868c7e1eab12707639cb7325cf805
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 55574fd8ee63cf49e0987dc5a9930f1c55befed8831f7e866e2d64e1d331d93a06ebb6bfe609a1f809395ecb141bcc3dd974dab51d837ecdcd583fdd35b36662
|
7
|
+
data.tar.gz: 215cd7b654f295ce7f6c11956494b4b3112fce5fbbbf363e0533b6821608cf0adc115bf84ba21765af3fdf4f6025ab363e83d553d789d4d5834a6a5e0c7aac3e
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
guard :rspec, cmd: 'zeus rspec --color --format nested --fail-fast', all_after_pass: false, all_on_start: false do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
4
|
+
watch('spec/spec_helper.rb') { "spec" }
|
5
|
+
|
6
|
+
# Rails
|
7
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
8
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
9
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb"] }
|
10
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
11
|
+
watch('config/routes.rb') { "spec/routing" }
|
12
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
13
|
+
|
14
|
+
# Capybara features
|
15
|
+
watch(%r{^app/views/(.+)/.*\.(erb)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
16
|
+
end
|
17
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Justin Aiken
|
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.markdown
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# My Timeline
|
2
|
+
#### A social-media aggregation/display plugin
|
3
|
+
|
4
|
+
This is a Rails Engine to help pull in content from any number of social media sites, services, or websites.
|
5
|
+
The aggregated information is displayed in a unified timeline.
|
6
|
+
|
7
|
+
It is being developed with extensibility in mind - each service will have it's own plugin.
|
8
|
+
|
9
|
+
What it looks like:
|
10
|
+

|
11
|
+
|
12
|
+
### Requirements:
|
13
|
+
- Rails 3.x - Rails 4 is not currently supported, but it's on the todo..
|
14
|
+
- Bootstrap (or bootstrap-named classes) - For the markup. Just stuff like `table.table-striped`, no stuctural markup from Bootstrap is needed
|
15
|
+
- Any standard ActiveRecord-compatible database should work
|
16
|
+
|
17
|
+
### Supported services:
|
18
|
+
|
19
|
+
- [Runkeeper](https://github.com/JustinAiken/my_timeline-health_graph)
|
20
|
+
- [Twitter](https://github.com/JustinAiken/my_timeline-twitter) - COMING SOON
|
21
|
+
- [Github](https://github.com/JustinAiken/my_timeline-github) - COMING SOON
|
22
|
+
- If you develop another, let me know and I'll add it here!
|
23
|
+
|
24
|
+
### Usage:
|
25
|
+
|
26
|
+
1. Add the gem to your Gemfile: `gem 'my_timeline'` and `bundle install`
|
27
|
+
2. Install the config file: `rails g my_timeline:install`
|
28
|
+
3. Edit `config/initializers/my_timeline.rb` to taste
|
29
|
+
4. Mount the engine in your routes:
|
30
|
+
```ruby
|
31
|
+
# A timeline belongs_to User
|
32
|
+
resources :users do
|
33
|
+
mount MyTimeline::Engine => '/timeline', as: :my_timeline
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
or
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# No Users, just a dedicated timeline route
|
41
|
+
mount MyTimeline::Engine => '/timeline', as: :my_timeline
|
42
|
+
```
|
43
|
+
5. Add a gem for any service you'd like to add on.
|
44
|
+
|
45
|
+
## Credits
|
46
|
+
|
47
|
+
Original author: [Justin Aiken](https://github.com/JustinAiken)
|
48
|
+
|
49
|
+
## Links
|
50
|
+
|
51
|
+
* [Source](https://github.com/JustinAiken/my_timeline)
|
52
|
+
* [Bug Tracker](https://github.com/JustinAiken/my_timeline/issues)
|
53
|
+
|
54
|
+
## Note on Patches/Pull Requests
|
55
|
+
|
56
|
+
* Fork the project.
|
57
|
+
* Make your feature addition or bug fix.
|
58
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
59
|
+
* Commit, do not mess with rakefile, version, or history.
|
60
|
+
* If you want to have your own version, that is fine but bump version in a commit by itself so I can ignore when I pull
|
61
|
+
* Send me a pull request. Bonus points for topic branches.
|
62
|
+
|
63
|
+
## Copyright
|
64
|
+
|
65
|
+
Copyright (c) 2013 Justin Aiken Inc. MIT license (see LICENSE for details).
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
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
|
+
|
8
|
+
begin
|
9
|
+
require 'rdoc/task'
|
10
|
+
rescue LoadError
|
11
|
+
require 'rdoc/rdoc'
|
12
|
+
require 'rake/rdoctask'
|
13
|
+
RDoc::Task = Rake::RDocTask
|
14
|
+
end
|
15
|
+
|
16
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
17
|
+
rdoc.rdoc_dir = 'rdoc'
|
18
|
+
rdoc.title = 'MyTimeline'
|
19
|
+
rdoc.options << '--line-numbers'
|
20
|
+
rdoc.rdoc_files.include('README.rdoc')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|
23
|
+
|
24
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
25
|
+
load 'rails/tasks/engine.rake'
|
26
|
+
|
27
|
+
Bundler::GemHelper.install_tasks
|
28
|
+
|
29
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
|
30
|
+
|
31
|
+
require 'rspec/core'
|
32
|
+
require 'rspec/core/rake_task'
|
33
|
+
|
34
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
35
|
+
RSpec::Core::RakeTask.new spec: 'app:db:test:prepare'
|
36
|
+
|
37
|
+
task default: :spec
|
File without changes
|
Binary file
|
@@ -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
|
+
*/
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class MyTimeline::ApplicationController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :find_user
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def find_user
|
8
|
+
@user = MyTimeline.user_class.send "find_by_#{MyTimeline.user_slug}", params[:user_id]
|
9
|
+
|
10
|
+
if @user == current_user
|
11
|
+
@owner_viewing = true
|
12
|
+
@show_hidden = true
|
13
|
+
else
|
14
|
+
#
|
15
|
+
end
|
16
|
+
|
17
|
+
params.delete :user_id
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module MyTimeline
|
2
|
+
class EventsController < MyTimeline::ApplicationController
|
3
|
+
|
4
|
+
def index
|
5
|
+
if @show_hidden
|
6
|
+
q = {}
|
7
|
+
else
|
8
|
+
q = {public: true}
|
9
|
+
end
|
10
|
+
|
11
|
+
@events = @user.events.where(q).desc.page params[:page]
|
12
|
+
|
13
|
+
@events_by_day = @events.all.to_a.group_by { |e| e.happened_on.to_date }
|
14
|
+
@dates_with_events = build_dates
|
15
|
+
end
|
16
|
+
|
17
|
+
def show
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def edit
|
22
|
+
@event = Event.find_by_id(params[:id])
|
23
|
+
end
|
24
|
+
|
25
|
+
def update
|
26
|
+
@event = Event.find_by_id(params[:id])
|
27
|
+
if @event.update_attributes(params[:event])
|
28
|
+
redirect_to root_path, notice: "Edit successful."
|
29
|
+
else
|
30
|
+
render 'edit'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def destroy
|
35
|
+
@event = Event.find_by_id(params[:id])
|
36
|
+
@event.destroy
|
37
|
+
|
38
|
+
redirect_to root_path
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
DateWithEvents = Struct.new(:date, :events)
|
44
|
+
|
45
|
+
def build_dates
|
46
|
+
[].tap do |array|
|
47
|
+
@events_by_day.each do |date, events|
|
48
|
+
array << DateWithEvents.new(date, events.reverse)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module MyTimeline
|
2
|
+
class PostsController < MyTimeline::ApplicationController
|
3
|
+
|
4
|
+
def new
|
5
|
+
@event = Event.new
|
6
|
+
@post = Post.new(event: @event)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create
|
10
|
+
@post = Post.new(params[:post])
|
11
|
+
|
12
|
+
@post.event.happened_on = @post.happened_on
|
13
|
+
@post.event.user_id = @user.id
|
14
|
+
@post.event.icon_name = "notes.png"
|
15
|
+
|
16
|
+
if @post.save
|
17
|
+
@post.event.linkable = @post
|
18
|
+
@post.event.save
|
19
|
+
|
20
|
+
redirect_to root_path, notice: "Post saved."
|
21
|
+
else
|
22
|
+
render :new
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module MyTimeline
|
2
|
+
class Event < ActiveRecord::Base
|
3
|
+
attr_accessible :description, :happened_on, :icon_name, :external_link, :original_id, :public, :importance
|
4
|
+
attr_accessible :user, :linkable, :user_id, :linkable_type, :linkable_id
|
5
|
+
|
6
|
+
belongs_to :linkable, polymorphic: true, dependent: :destroy
|
7
|
+
belongs_to :user, class_name: MyTimeline.user_class.to_s
|
8
|
+
|
9
|
+
validates :description, presence: true
|
10
|
+
validates :happened_on, presence: true
|
11
|
+
validates :importance, inclusion: {in: 1..10, allow_blank: true, message: "%{value} is not between 1-10." }
|
12
|
+
|
13
|
+
scope :desc, order("my_timeline_events.happened_on DESC")
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module MyTimeline
|
2
|
+
class Post < ActiveRecord::Base
|
3
|
+
attr_accessible :happened_on, :full_text
|
4
|
+
attr_accessible :event, :event_id, :event_attributes
|
5
|
+
|
6
|
+
belongs_to :event, dependent: :destroy
|
7
|
+
|
8
|
+
validates :happened_on, presence: true
|
9
|
+
validates :full_text, presence: true
|
10
|
+
|
11
|
+
accepts_nested_attributes_for :event
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module MyTimeline
|
2
|
+
class EventPresenter
|
3
|
+
|
4
|
+
attr_accessor :event
|
5
|
+
|
6
|
+
def initialize(event)
|
7
|
+
@event = event
|
8
|
+
end
|
9
|
+
|
10
|
+
def icon_path
|
11
|
+
"my_timeline/icons/#{event.icon_name}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def happened_on
|
15
|
+
event.happened_on.strftime("%-l:%M %P")
|
16
|
+
end
|
17
|
+
|
18
|
+
def id
|
19
|
+
event.id
|
20
|
+
end
|
21
|
+
|
22
|
+
def method_missing(meth, *args, &blk)
|
23
|
+
if event.respond_to?(meth)
|
24
|
+
event.send meth, *args
|
25
|
+
else
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1><%= I18n.t("my_timeline.control_panel.header") %></h1>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<% @enabled_plugins.each do |plug| %>
|
6
|
+
<%= render partial: "my_timeline/#{plug}/control_panel" %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<h3> New Post </h3>
|
10
|
+
<%= link_to "Add", new_post_path %> a self-contained post.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<table class="<%= MyTimeline.table_class %>">
|
2
|
+
<thead>
|
3
|
+
<th></th>
|
4
|
+
</thead>
|
5
|
+
<tbody>
|
6
|
+
<% events.each do |event| %>
|
7
|
+
<tr>
|
8
|
+
<td style="vertical-align:middle;">
|
9
|
+
<%= render partial: 'my_timeline/events/event', object: MyTimeline::EventPresenter.new(event) %>
|
10
|
+
</td>
|
11
|
+
</tr>
|
12
|
+
<% end %>
|
13
|
+
</tbody>
|
14
|
+
</table>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<p>
|
2
|
+
<%= link_to "show_event_path(event.id)", remote: true do %>
|
3
|
+
<%= glyph 'plus-sign' %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%= image_tag event.icon_path, size: "32x32" %>
|
7
|
+
<%= event.happened_on %> -
|
8
|
+
<%= raw event.description %>
|
9
|
+
<% if @owner_viewing %>
|
10
|
+
<%= link_to edit_event_path(event.id) do %>
|
11
|
+
<%= glyph 'pencil' %>
|
12
|
+
<% end %>
|
13
|
+
<%= link_to event_path(event.event), method: :delete do %>
|
14
|
+
<%= glyph 'remove-sign' %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
</p>
|