Skip to content

Instantly share code, notes, and snippets.

View maeda-m's full-sized avatar

Minoru Maeda maeda-m

View GitHub Profile
@maeda-m
maeda-m / README.md
Last active February 2, 2024 04:17
View Customize(Redmine):チケット編集フォームにおけるラベルの折り返しを調整したい

View Customize(Redmine):チケット編集フォームにおけるラベルの折り返しを調整したい

はじめに

下表の環境で動作確認はしましたが、継続的に利用できることや不具合が生じないことを保証するものではありません。 無保証ですので一切の責任を負わないものとします。自己責任でご利用ください。

項目 値          
RedMica v2.4.1.stable (based on Redmine 5.1.1.devel)
@maeda-m
maeda-m / membership.rb
Created October 23, 2017 08:35
Redmine API Example
class Membership < RedmineBase
attr_accessor :id, :project_id, :user_id, :role_ids
def project=(attrs = {})
self.project_id = attrs[:id]
end
def project
if self.project_id
return Project.all.find do |project|

クラスベースの実装

Generator API が使いにくい問題の解決策として、クラスベースの実装方法を考える。 なお、クラスベースでの利用は Generator の当初の設計思想に含まれているが、現状ではいろいろ足りていない。

注意: 下記コードは、実装の提案のためのものであり、実際に動作するものではない。

Report 定義

# coding: utf-8
require 'rubygems'
require 'thinreports'
# Prepare sample data.
data = []
my_info = {
my_name: 'Matsukei Co., Ltd.',
# coding: utf-8
require 'rubygems'
require 'thinreports'
require 'open-uri'
def open_chart(*params)
open('http://chart.googleapis.com/chart?' + URI.encode(params.join('&')))
end
# coding: utf-8
class VisitorPassController < ApplicationController
def create_pass
visitor = Visitor.find(params[:id])
report = ThinReports::Report.new layout: File.join(Rails.root, 'app', 'reports', 'visitor_pass.tlf')
report.start_new_page do |page|
# jpg_filepath method will return the path of JPEG file.
# e.g. "Rails.root/photos/visitor_001.jpg"
page.item(:photo).src(visitor.jpg_filepath)