I'm looking for a part-time remote job.

Hire me


I'm the author of:

Mastering Redmine is a comprehensive guide with tips, tricks and best practices, and an easy-to-learn structure.

Check the book's project or

Buy the book

Social pages of the book:

By buying this book you also donate to Redmine (see this page).


Follow me:

Patch #1860

Download button Wiki/Textile macro

Added by Andriy Lesyuk about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
26 Sep 2011
Due date:
28 Jan 2012
% Done:

100%

Redmine version:
External issue:

Description

Many times I wanted to put Download button in Wiki pages, news etc.

So it would be nice to have a macro like {DOWNLOAD}...

compatibility_with_chili_project_and_addition_of_wiki_macro_or_liquid_tag_for_chili_project_3_0.patch View - Patch for r16. Implements this feature and fixes #1929. (12.8 KB) Andreas Schuh, 05 Jan 2012 19:28

02-compatibility_with_chili_project_and_addition_of_wiki_macro_or_liquid_tag_for_chili_project_3_0.patch View - Revised patch for r16. Implements this feature and fixes #1929. (10.7 KB) Andreas Schuh, 05 Jan 2012 20:42

03-compatibility_with_chili_project_and_addition_of_wiki_macro_or_liquid_tag_for_chili_project_3_0.patch View - Fixed patch for r16. Implements this feature and fixes #1929. (11.4 KB) Andreas Schuh, 05 Jan 2012 22:32

04-compatibility_with_chili_project_and_addition_of_wiki_macro_or_liquid_tag_for_chili_project_3_0.patch View - Patch for r16. Implements feature #1860 and fixes #1929. (10.2 KB) Andreas Schuh, 09 Jan 2012 05:34

History

#1 Updated by Andreas Schuh almost 13 years ago

Wow, I actually didn’t notice this issue before... I just implemented this and wanted to share the patch with you.

The implementation for Redmine was actually quickly done, but the new Liquid layer in ChiliProject 3.0 gave me some troubles. However, here it is.

Use in Redmine/ChiliProject < 3.0 as follows: {{download_button}}
Use in ChiliProject >= 3.0 as follows: {% download_button %}

Additionally, each of these macros/tags can have additional attributes to slightly change the style and/or the attributes of the DownloadButton.

For example,

Redmine/ChiliProject 2.x

{{download_button(package=nifticlib, label=Get the NIfTI library for C!, include_version=false, width=200px, font_size=20px)}}
{{download_button(float=left, margin_right=10px)}}

ChiliProject 3.x:

{% download_button package=nifticlib, label=Get the NIfTI library for C!, include_version=false, width=200px, font_size=20px %}
{% download_button float=left, margin_right=10px %}

(optionally, the argument list can in this case be enclosed in either braces, double quotes, or single quotes)

You may consider renaming this macro/tag to !{{download}} if you prefer. I was just thinking download_button clarifies that the macro/tag will only place a button there, but not perform a download action... on the other side, the name of the plugin is download. The decision is up to you.

BTW This macro/tag works also great with your sidebar content plugin. This way it is even better configurable for which views to render the download button in the sidebar. Further it can be accompanied by additional text/graphics...

#2 Updated by Andreas Schuh almost 13 years ago

Here is a clean version of the patch with all unnecessary changes reverted which I made while I was trying to get the Liquid tag for ChiliProject 3.0 working... further, I reverted the bump of the version number here as well.

#3 Updated by Andreas Schuh almost 13 years ago

Of course I yet found some bugs in the parsing of the macro arguments (shouldn’t have just copied the function from Redmine). Played more with it now and am satisfied so far. I renamed the macro to !{{download}}, respectively, {% download %} now, by the way.

#4 Updated by Andriy Lesyuk almost 13 years ago

Wow! Thank you very much! Will include your changes in the next version!

#5 Updated by Andriy Lesyuk almost 13 years ago

  • Target version set to 0.0.3

#6 Updated by Andreas Schuh almost 13 years ago

I just noticed a minor mistake in the patch. I forgot to remove the obsolete code from DownloadMacroHelper#extract_download_options() which has been moved to DownloadMacroHelper#to_container_style() and DownloadMacroHelper#to_button_style(), respectively.

So here’s the once more modified patch...

#7 Updated by Andriy Lesyuk almost 13 years ago

  • Tracker changed from Feature to Patch
  • % Done changed from 0 to 80
  • External issue set to ChiliProject#816

#8 Updated by Andriy Lesyuk almost 13 years ago

  • Due date set to 28 Jan 2012
  • Status changed from Open to Closed
  • % Done changed from 80 to 100

Also available in: Atom PDF

Terms of use | Privacy policy