ecm_time_tracking 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9f7858a89c71006be1cf675ab74c7ae847c99f05
4
+ data.tar.gz: 8d94facde52dcf0974619cac797623dbd90c1632
5
+ SHA512:
6
+ metadata.gz: 1dc4b7c78873ab4e79c8f8dc452c0df02122e164855d4e6af6905bfb8197a7f47aaca837e948891d0b42fcf17ff87c18fa70e9e9ddcb0a3c8da3cf7c5ae499a6
7
+ data.tar.gz: 946179cf1484a9db5850bc2d59a27d2d88ae2dc3be88ddd1959f7449d99e19209e555fa5c27b5375c21851f2f5a3259058e0bc63b47a7fdda3f686c08201a1a6
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Roberto Vasquez Angel
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.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Ecm::TimeTracking
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,18 @@
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 = 'Ecm::TimeTracking'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+ Bundler::GemHelper.install_tasks
@@ -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/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,14 @@
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 other CSS/SCSS
10
+ * files in this directory. It is generally better to create a new file per style scope.
11
+ *
12
+ *= require_tree .
13
+ *= require_self
14
+ */
@@ -0,0 +1,6 @@
1
+ module Ecm
2
+ module TimeTracking
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Ecm
2
+ module TimeTracking
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,40 @@
1
+ module Ecm::TimeTracking
2
+ class Entry < ActiveRecord::Base
3
+ DEFAULT_DUE_HOURS_PER_DAY = 8
4
+ DEFAULT_BREAK_LENGTH_IN_MINUTES = 45
5
+
6
+ belongs_to :tracker, class_name: Configuration.tracker_class_name, foreign_key: 'tracker_id'
7
+
8
+ validates :tracker, :begin_at, :end_at, presence: true
9
+
10
+ after_initialize :set_defaults, if: :new_record?
11
+
12
+ def break_length_in_minutes=(break_length_in_minutes)
13
+ self.break_length_in_seconds = break_length_in_minutes.to_i * 60
14
+ end
15
+
16
+ def break_length_in_minutes
17
+ (break_length_in_seconds || 0) / 60
18
+ end
19
+
20
+ def length
21
+ end_at - begin_at
22
+ end
23
+
24
+ def overtime
25
+ length - due - (break_length_in_seconds || 0)
26
+ end
27
+
28
+ private
29
+
30
+ def set_defaults
31
+ self.end_at = Time.zone.now.change(sec: 0)
32
+ self.begin_at = self.end_at - DEFAULT_DUE_HOURS_PER_DAY.hours - DEFAULT_BREAK_LENGTH_IN_MINUTES.minutes
33
+ self.break_length_in_minutes = DEFAULT_BREAK_LENGTH_IN_MINUTES
34
+ end
35
+
36
+ def due
37
+ DEFAULT_DUE_HOURS_PER_DAY * 60 * 60
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Time tracking</title>
5
+ <%= stylesheet_link_tag "ecm/time_tracking/application", media: "all" %>
6
+ <%= javascript_include_tag "ecm/time_tracking/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,17 @@
1
+ de:
2
+ activerecord:
3
+ attributes:
4
+ ecm/time_tracking/entry:
5
+ begin_at: Von
6
+ break_length_in_minutes: Pause [Minuten]
7
+ description: Beschreibung
8
+ end_at: Bis
9
+ length: Länge
10
+ overtime: Überzeit
11
+ tracker: Erfasser
12
+ created_at: Erstellt am
13
+ updated_at: Aktualisiert am
14
+ models:
15
+ ecm/time_tracking/entry:
16
+ one: Eintrag
17
+ other: Einträge
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Ecm::TimeTracking::Engine.routes.draw do
2
+ end
@@ -0,0 +1,13 @@
1
+ class CreateEcmTimeTrackingEntries < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_time_tracking_entries do |t|
4
+ t.integer :tracker_id
5
+ t.timestamp :begin_at
6
+ t.timestamp :end_at
7
+ t.integer :break_length_in_seconds
8
+ t.text :description
9
+
10
+ t.timestamps null: false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ require 'active_support/core_ext/module/delegation'
2
+ require 'active_support/core_ext/module/attribute_accessors'
3
+
4
+ module Ecm
5
+ module TimeTracking
6
+ module Configuration
7
+ def configure
8
+ yield self
9
+ end
10
+
11
+ mattr_accessor :tracker_class_name do
12
+ nil
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ module Ecm
2
+ module TimeTracking
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Ecm::TimeTracking
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Ecm
2
+ module TimeTracking
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'ecm/time_tracking/configuration'
2
+
3
+ module Ecm
4
+ module TimeTracking
5
+ extend Configuration
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ require "ecm/time_tracking"
2
+ require "ecm/time_tracking/engine"
@@ -0,0 +1,15 @@
1
+ module Ecm
2
+ module TimeTracking
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc 'Generates the intializer'
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def generate_initializer
10
+ copy_file 'initializer.rb', 'config/initializers/ecm_time_tracking.rb'
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ Ecm::TimeTracking.configure do |config|
2
+ # Set the resource class name, that will track time.
3
+ #
4
+ # Default: config.tracker_class_name = 'User'
5
+ #
6
+ config.tracker_class_name = 'User'
7
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :time_tracking do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ecm_time_tracking
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Roberto Vasquez Angel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-06 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Ecm::TimeTracking Module.
28
+ email:
29
+ - roberto@vasquez-angel.de
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.rdoc
36
+ - Rakefile
37
+ - app/assets/javascripts/ecm/time_tracking/application.js
38
+ - app/assets/stylesheets/ecm/time_tracking/application.css
39
+ - app/controllers/ecm/time_tracking/application_controller.rb
40
+ - app/helpers/ecm/time_tracking/application_helper.rb
41
+ - app/models/ecm/time_tracking/entry.rb
42
+ - app/views/layouts/ecm/time_tracking/application.html.erb
43
+ - config/locales/de.yml
44
+ - config/routes.rb
45
+ - db/migrate/20160305142931_create_ecm_time_tracking_entries.rb
46
+ - lib/ecm/time_tracking.rb
47
+ - lib/ecm/time_tracking/configuration.rb
48
+ - lib/ecm/time_tracking/engine.rb
49
+ - lib/ecm/time_tracking/version.rb
50
+ - lib/ecm_time_tracking.rb
51
+ - lib/generators/ecm/time_tracking/install/install_generator.rb
52
+ - lib/generators/ecm/time_tracking/install/templates/initializer.rb
53
+ - lib/tasks/ecm/time_tracking_tasks.rake
54
+ homepage: https://github.com/robotex82/ecm_time_tracking
55
+ licenses:
56
+ - MIT
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.4.8
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Ecm::TimeTracking.
78
+ test_files: []
79
+ has_rdoc: