Commits

Dhananjay Nene committed 90f3ffb

Initial Commit

  • Participants

Comments (0)

Files changed (14)

File app/controllers/standup_reports_controller.rb

+require 'redcloth'
+
+class StandupReportsController < ApplicationController
+  before_filter :find_project, :authorize
+
+  def index
+	@reports = StandupReport.find(:all, 
+		:joins => :project, 
+		:conditions => ["projects.identifier = ?", params[:project_id]],
+		:order => "for_date DESC")
+  end
+
+  def new
+    # TODO: restrict to projects with permissions
+    # @projects = Project.find(:all)
+  end
+
+  def find_project
+	@project = Project.find(params[:project_id])
+    @current_user = User.find(session[:user_id])
+  end
+end

File app/helpers/standup_reports_helper.rb

+module StandupReportsHelper
+end

File app/models/standup_report.rb

+class StandupReport < ActiveRecord::Base
+  attr_accessor  :for_date, :project, :user, :done, :planned, :roadblocks
+
+  belongs_to :project
+  belongs_to :user
+
+  validates_presence_of :for_date, :project, :user
+  validates_uniqueness_of :for_date, :scope => [:project_id, :user_id]
+end

File app/views/standup_reports/create.html.erb

+<h2>StandupReports#create</h2>

File app/views/standup_reports/index.html.erb

+<% html_title "Standup Reports" %>
+<h2>StandupReports</h2>
+
+<table>
+<% @reports.each do |report| %>
+    <tr>
+        <td><%= report[:for_date] %></td>
+        <td><%= report.user.name %></td>
+        <td><%= report.project.name %></td>
+        <td><%= link_to 'Edit', {:action => 'edit', :id => report[:id] }, :method => :get %> </td>
+    </tr>
+    <tr>
+        <td colspan="4">
+            <table class="sr_notes">
+                <tr>
+                    <td><span class="sr_label"><%= l('sr_label_done') %>: </span><br/><%= textilize(report[:done]) %></td>
+                </tr>
+                <tr>
+                    <td><span class="sr_label"><%= l('sr_label_planned') %>: </span><br/><%= textilize(report[:planned]) %></td>
+                </tr>
+                <tr>
+                    <td><span class="sr_label"><%= l('sr_label_roadblocks') %>: </span><br/><%= textilize(report[:roadblocks]) %></td>
+                </tr>
+            </table>
+        </td>
+    </tr>
+<% end %>
+</table>
+
+<% content_for :header_tags do %>
+    <%= stylesheet_link_tag 'redmine_standup', :plugin => 'redmine_standup' %>
+<% end %>

File app/views/standup_reports/new.html.erb

+<% html_title "Create Standup Report" %>
+<h2>Create Standup Report</h2>
+
+<% form_tag ({}, :action => 'create', :method => :post) do%>
+    <table>
+        <tr>
+            <td class="sr_label"><%= l("sr_label_project") %></td>
+            <td><%= @project.name %></td>
+        </tr>
+        <tr>
+            <td class="sr_label"><%= l("sr_label_user") %></td>
+            <td><%= @current_user.firstname + " " + @current_user.lastname + " (" + @current_user.login + ")" %></td>
+        </tr>
+    </table>
+    <%= submit_tag l(:button_apply), :class => 'button-small', :name => "Create" %>
+<% end %>
+<% content_for :header_tags do %>
+    <%= stylesheet_link_tag 'redmine_standup', :plugin => 'redmine_standup' %>
+<% end %>

File app/views/standup_reports/view.html.erb

+<h2>StandupReports#view</h2>

File assets/stylesheets/redmine_standup.css

+.sr_notes { 
+    border: 1px dotted;
+}
+
+.sr_label {
+    font-weight: bold;
+}

File config/locales/en.yml

+en: 
+  sr_label_project: Project
+  sr_label_user: User
+  sr_label_done: Done
+  sr_label_planned: Planned
+  sr_label_roadblocks: Roadblocks

File db/migrate/001_create_standup_reports.rb

+class CreateStandupReports < ActiveRecord::Migration
+  def self.up
+    create_table :standup_reports do |t|
+      t.column :user_id, :integer
+      t.column :for_date, :date
+      t.column :project_id, :integer
+      t.column :done, :string, :null => true
+      t.column :planned, :string, :null => true
+      t.column :roadblocks, :string, :null => true
+    end
+  end
+
+  def self.down
+    drop_table :standup_reports
+  end
+end
+require 'redmine'
+
+Redmine::Plugin.register :redmine_standup do
+  name 'Redmine Standup'
+  author 'Dhananjay Nene'
+  description 'A plugin for filing standup reports. Useful for distributed teams'
+  version '0.0.1'
+
+  menu :application_menu, :standup_reports, { :controller => 'standup_reports', :action => 'index' }, :caption => 'Standup Reports'
+  menu :application_menu, :create_standup_report, { :controller => 'standup_reports', :action => 'new' }, :caption => 'Create Standup Report'
+
+  permission :use_standup_report, {:standup_reports => [:index, :new, :create, :edit]}
+  menu :project_menu, :project_standup_reports, { :controller => 'standup_reports', :action => 'index' }, 
+       :caption => 'Standup Reports', :after => :files, :param => :project_id
+  menu :project_menu, :project_create_standup_report, { :controller => 'standup_reports', :action => 'new' }, 
+       :caption => 'Create Standup Report', :after => :project_standup_reports, :param => :project_id
+
+  project_module :standup_reports do
+    permission :use_standup_report,  :standup_reports => [:index, :new, :create, :edit]
+  end
+end

File test/fixtures/standup_reports.yml

+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+one:
+  id: 1
+  user_id: 1
+  for_date: 2011-03-01
+  project_id: 1
+  done: MyString
+  planned: MyString
+  roadblocks: MyString
+two:
+  id: 2
+  user_id: 1
+  for_date: 2011-03-01
+  project_id: 1
+  done: MyString
+  planned: MyString
+  roadblocks: MyString

File test/functional/standup_reports_controller_test.rb

+require File.dirname(__FILE__) + '/../test_helper'
+
+class StandupReportsControllerTest < ActionController::TestCase
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end

File test/unit/standup_report_test.rb

+require File.dirname(__FILE__) + '/../test_helper'
+
+class StandupReportTest < ActiveSupport::TestCase
+  fixtures :standup_reports
+
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end