my_timeline 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +6 -0
- data/app/controllers/my_timeline/control_panel_controller.rb +6 -2
- data/app/presenters/my_timeline/event_presenter.rb +18 -1
- data/app/views/my_timeline/events/_event.html.erb +1 -1
- data/lib/generators/templates/my_timeline.rb +3 -0
- data/lib/my_timeline.rb +6 -3
- data/lib/my_timeline/engine.rb +5 -2
- data/lib/my_timeline/settings_ext.rb +2 -1
- data/lib/my_timeline/user_stub.rb +22 -10
- data/lib/my_timeline/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c900ff1d59717d4d8b507507360f9a0acb785387
|
4
|
+
data.tar.gz: ded000abf734348cd2fbf1938f66e3122424aa75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbef9bb8f0e43e3c60bdd4ff17b4789c47c27c83c54c8f85fc5fd043377b651b8a75e332eecf9c715827daec21952d6c682253f149cc0cc49e197ed3681a0798
|
7
|
+
data.tar.gz: 04f35066cd299b80460f6f80de144f2f6e689d84c57fab2d45c05aa26842177f512da9b899474a667de58c6960fb35817c9238899e1fe2e7bc4cc448ff048613
|
data/CHANGELOG.markdown
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 0.1.0
|
2
|
+
* [BUGFIX] Fix the settings to reload in development mode
|
3
|
+
* [BUGFIX] Fix the user stub
|
4
|
+
* [FEATURE] Display event's times with the User's timezone, and make the time formatting configurable
|
5
|
+
* [BUGFIX] Make the plugin registry a Set instead of an Array to avoid duplicates
|
6
|
+
|
1
7
|
# 0.0.5
|
2
8
|
* [FEATURE] Added a detail view that expands below the summary post, if that model supports an expandable view (defaults to not.)
|
3
9
|
* [BUGFIX] Dehardcode header text
|
@@ -9,7 +9,7 @@ module MyTimeline
|
|
9
9
|
if rails4?
|
10
10
|
@user.time_zone = user_params[:time_zone]
|
11
11
|
else
|
12
|
-
@user.time_zone = params[
|
12
|
+
@user.time_zone = params[user_param][:time_zone]
|
13
13
|
end
|
14
14
|
|
15
15
|
@user.save!
|
@@ -20,8 +20,12 @@ module MyTimeline
|
|
20
20
|
|
21
21
|
if rails4?
|
22
22
|
define_method :user_params do
|
23
|
-
params.required(
|
23
|
+
params.required(user_param).permit :time_zone
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
def user_param
|
28
|
+
MyTimeline.user_class.model_name.param_key.to_sym
|
29
|
+
end
|
26
30
|
end
|
27
31
|
end
|
@@ -12,13 +12,30 @@ module MyTimeline
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def happened_on
|
15
|
-
|
15
|
+
time.strftime MyTimeline.time_formatter
|
16
16
|
end
|
17
17
|
|
18
18
|
def id
|
19
19
|
event.id
|
20
20
|
end
|
21
21
|
|
22
|
+
private
|
23
|
+
|
24
|
+
def time
|
25
|
+
return event.happened_on if event.linkable.class.respond_to? :keep_original_time_zone?
|
26
|
+
return event.happened_on unless user.time_zone.present?
|
27
|
+
|
28
|
+
event.happened_on.in_time_zone user.time_zone
|
29
|
+
end
|
30
|
+
|
31
|
+
def user
|
32
|
+
if MyTimeline.user_class == MyTimeline::UserStub
|
33
|
+
MyTimeline::UserStub
|
34
|
+
else
|
35
|
+
event.user
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
22
39
|
def method_missing(meth, *args, &blk)
|
23
40
|
if event.respond_to?(meth)
|
24
41
|
event.send meth, *args
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<%= link_to event.external_link do %>
|
8
8
|
<%= image_tag event.icon_path, size: "32x32" %>
|
9
9
|
<% end %>
|
10
|
-
<%= event.happened_on %>
|
10
|
+
<%= event.happened_on %>
|
11
11
|
<%= raw event.description %>
|
12
12
|
<% if @owner_viewing %>
|
13
13
|
<%= link_to edit_event_path(event.id) do %>
|
data/lib/my_timeline.rb
CHANGED
@@ -5,7 +5,7 @@ require "my_timeline/engine"
|
|
5
5
|
|
6
6
|
module MyTimeline
|
7
7
|
|
8
|
-
mattr_accessor :user_class, :user_slug, :render_method, :table_class, :config_object, :enabled_plugins
|
8
|
+
mattr_accessor :user_class, :user_slug, :render_method, :table_class, :config_object, :enabled_plugins, :time_formatter
|
9
9
|
|
10
10
|
@@user_class = 'MyTimeline::UserStub'
|
11
11
|
def self.user_class
|
@@ -19,8 +19,11 @@ module MyTimeline
|
|
19
19
|
|
20
20
|
@@table_class = "table table-striped"
|
21
21
|
|
22
|
-
@@
|
23
|
-
|
22
|
+
@@time_formatter = "%-l:%M %P - "
|
23
|
+
|
24
|
+
@@enabled_plugins = Set.new
|
25
|
+
def self.register_plugin(plugin_name, options = {})
|
26
|
+
MyTimeline.config_object.key plugin_name, options
|
24
27
|
@@enabled_plugins << plugin_name
|
25
28
|
end
|
26
29
|
|
data/lib/my_timeline/engine.rb
CHANGED
@@ -3,7 +3,6 @@ require 'my_timeline/core_ext/rails4'
|
|
3
3
|
|
4
4
|
module MyTimeline
|
5
5
|
class Engine < ::Rails::Engine
|
6
|
-
include SettingsExt
|
7
6
|
|
8
7
|
isolate_namespace MyTimeline
|
9
8
|
|
@@ -18,7 +17,11 @@ module MyTimeline
|
|
18
17
|
end
|
19
18
|
|
20
19
|
config.after_initialize do |app|
|
21
|
-
extend_rails_settings
|
20
|
+
MyTimeline::SettingsExt.extend_rails_settings
|
22
21
|
end
|
22
|
+
|
23
|
+
config.to_prepare do |app|
|
24
|
+
MyTimeline::SettingsExt.extend_rails_settings
|
25
|
+
end if Rails.env.development?
|
23
26
|
end
|
24
27
|
end
|
@@ -2,7 +2,7 @@ require 'rails-settings'
|
|
2
2
|
|
3
3
|
module MyTimeline
|
4
4
|
module SettingsExt
|
5
|
-
def extend_rails_settings
|
5
|
+
def self.extend_rails_settings
|
6
6
|
|
7
7
|
RailsSettings::SettingObject.class_eval do
|
8
8
|
self.table_name = "my_timeline_settings"
|
@@ -35,3 +35,4 @@ module MyTimeline
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
@@ -1,38 +1,50 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
1
3
|
module MyTimeline
|
2
4
|
class UserStub
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
include ActiveModel::Validations
|
8
|
+
include ActiveModel::Conversion
|
9
|
+
extend ActiveModel::Naming
|
3
10
|
|
4
|
-
def
|
11
|
+
def events
|
5
12
|
Event
|
6
13
|
end
|
7
14
|
|
8
|
-
def
|
9
|
-
RailsSettings::SettingObject
|
15
|
+
def settings(var = :core)
|
16
|
+
RailsSettings::SettingObject.find_by_var var
|
10
17
|
end
|
11
18
|
|
12
|
-
def
|
19
|
+
def id
|
13
20
|
nil
|
14
21
|
end
|
15
22
|
|
16
|
-
def
|
23
|
+
def save!
|
17
24
|
true
|
18
25
|
end
|
19
26
|
|
27
|
+
def persisted?
|
28
|
+
false
|
29
|
+
end
|
30
|
+
|
20
31
|
def self.method_missing(meth, *args, &blk)
|
21
32
|
if meth.to_s =~ /^find_by/
|
22
33
|
UserStub
|
23
34
|
else
|
24
|
-
|
35
|
+
instance.send meth, *args, &blk
|
36
|
+
# super
|
25
37
|
end
|
26
38
|
end
|
27
39
|
|
28
40
|
def self.settings_attr_accessor(*args)
|
29
41
|
args.each do |method_name|
|
30
42
|
eval "
|
31
|
-
def
|
32
|
-
|
43
|
+
def self.#{method_name.to_s}
|
44
|
+
RailsSettings::SettingObject.find_by_var(:core).send('#{method_name}')
|
33
45
|
end
|
34
|
-
def
|
35
|
-
|
46
|
+
def self.#{method_name.to_s}=(value)
|
47
|
+
RailsSettings::SettingObject.find_by_var(:core).send('#{method_name}=', value)
|
36
48
|
end
|
37
49
|
"
|
38
50
|
end
|
data/lib/my_timeline/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_timeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Aiken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|