naidu / redmine-dmsf

Automatically exported from code.google.com/p/redmine-dmsf
0 stars 0 forks source link

DMSF macro enanchement: link to document description #179

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We'd like to share with you an all the others a little improvement we have done 
to dmsf macros, adding a new one to jump to the  document instead of 
downloading it.

We 'cloned' the  dmsf macro into a new one, dmsfd, inside the file 
/redmine_dmsf/init.rb:

Redmine::WikiFormatting::Macros.register do
    desc "Wiki link to DMSF document description:\n\n" +
             "{{dmsfd(file_id [, title [, revision_id]])}}\n\n" +
         "_file_id_ / _revision_id_ can be found in link for file/revision download." 

    macro :dmsfd do |obj, args|
      return nil if args.length < 1 # require file id
      entry_id = args[0].strip
      entry = DmsfFile.find(entry_id)
      unless entry.nil? || entry.deleted
        title = args[1] ? args[1] : entry.title
        revision = args[2] ? args[2] : "" 
        return link_to "#{title}", :controller => "dmsf_files", :action => "show", :id => entry
      end
      nil
    end
  end

What version of the DMSF and Redmine are you using? On what browser and
operating
system?

redine 1.2.0, dmsf 1.2.1

Please provide any additional information below.

Feel free to do with this macro what you think could be useful to do.
From our side, in our way of using dmsf we have found very useful to include 
into tasks and wikipages the link to a document description instead of going 
straight to the file download (e.g.: it helps to understand where a document is)

Original issue reported on code.google.com by pia.alg...@gmail.com on 9 Nov 2011 at 12:06

GoogleCodeExporter commented 9 years ago
thx a lot

Original comment by vit.jo...@gmail.com on 10 Nov 2011 at 8:39

GoogleCodeExporter commented 9 years ago

Original comment by vit.jo...@gmail.com on 12 Jan 2012 at 12:42