From 78ea4bcd397a4d8f39ad3c08066fe918a8fc89ad Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 11 Apr 2013 10:51:28 +0200 Subject: file uploader --- app/views/generic_files/_form.html.haml | 7 +++++++ app/views/generic_files/_form_core.html.haml | 7 +++++++ app/views/generic_files/_index_core.html.haml | 14 ++++++++++++++ app/views/generic_files/edit.html.haml | 3 +++ app/views/generic_files/index.html.haml | 6 ++++++ app/views/generic_files/new.html.haml | 3 +++ app/views/generic_files/show.html.haml | 20 ++++++++++++++++++++ 7 files changed, 60 insertions(+) create mode 100644 app/views/generic_files/_form.html.haml create mode 100644 app/views/generic_files/_form_core.html.haml create mode 100644 app/views/generic_files/_index_core.html.haml create mode 100644 app/views/generic_files/edit.html.haml create mode 100644 app/views/generic_files/index.html.haml create mode 100644 app/views/generic_files/new.html.haml create mode 100644 app/views/generic_files/show.html.haml (limited to 'app/views/generic_files') diff --git a/app/views/generic_files/_form.html.haml b/app/views/generic_files/_form.html.haml new file mode 100644 index 0000000..8912daa --- /dev/null +++ b/app/views/generic_files/_form.html.haml @@ -0,0 +1,7 @@ += simple_form_for([@parent, @generic_file]) do |f| + = f.error_notification + + = render "form_core", :f => f + + .form-actions + = f.button :submit, conditional_t('generic_files.form.submit') diff --git a/app/views/generic_files/_form_core.html.haml b/app/views/generic_files/_form_core.html.haml new file mode 100644 index 0000000..b0e8889 --- /dev/null +++ b/app/views/generic_files/_form_core.html.haml @@ -0,0 +1,7 @@ +.inputs + - if @generic_file.new_record? + = f.input :file, :label => t('generic_files.form.file.label'), :hint => conditional_hint('generic_files.form.file.hint') + - else + = f.input :file_type, :label => t('generic_files.form.file_type.label'), :hint => conditional_hint('generic_files.form.file_type.hint'), :disabled => true + = f.input :name, :label => t('generic_files.form.name.label'), :hint => conditional_hint('generic_files.form.name.hint') + = f.input :category, :label => t('generic_files.form.category.label'), :collection => GenericFile::CATEGORIES, :hint => conditional_hint('generic_files.form.category.hint'), :include_blank => false diff --git a/app/views/generic_files/_index_core.html.haml b/app/views/generic_files/_index_core.html.haml new file mode 100644 index 0000000..5fa66f7 --- /dev/null +++ b/app/views/generic_files/_index_core.html.haml @@ -0,0 +1,14 @@ +%table.table.table-striped + %tr + %th= t('generic_files.index.category') + %th= t('generic_files.index.name') + %th= t('generic_files.index.file_type') + + - for generic_file in generic_files + %tr + %td= generic_file.category + %td= generic_file.name + %td= generic_file.file_type + + + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => generic_file.owner, :child => generic_file} \ No newline at end of file diff --git a/app/views/generic_files/edit.html.haml b/app/views/generic_files/edit.html.haml new file mode 100644 index 0000000..b59dd2b --- /dev/null +++ b/app/views/generic_files/edit.html.haml @@ -0,0 +1,3 @@ +- content_for :title, t("generic_files.edit.page_title") + += render "form" \ No newline at end of file diff --git a/app/views/generic_files/index.html.haml b/app/views/generic_files/index.html.haml new file mode 100644 index 0000000..b3c489e --- /dev/null +++ b/app/views/generic_files/index.html.haml @@ -0,0 +1,6 @@ +- content_for :title, t("generic_files.index.page_title") + +- if @generic_files && @generic_files.count > 0 + = render "index_core", :generic_files => @generic_files + += render :partial => 'shared/create_link', :locals => {:parent => @parent, :child_class => GenericFile} \ No newline at end of file diff --git a/app/views/generic_files/new.html.haml b/app/views/generic_files/new.html.haml new file mode 100644 index 0000000..05af0da --- /dev/null +++ b/app/views/generic_files/new.html.haml @@ -0,0 +1,3 @@ +- content_for :title, t("generic_files.new.page_title") + += render "form" \ No newline at end of file diff --git a/app/views/generic_files/show.html.haml b/app/views/generic_files/show.html.haml new file mode 100644 index 0000000..b375dfc --- /dev/null +++ b/app/views/generic_files/show.html.haml @@ -0,0 +1,20 @@ +- content_for :title, t("generic_files.show.page_title") + +%p + %strong= t('generic_files.show.category') + ":" + = @generic_file.category + +%p + %strong= t('generic_files.show.name') + ":" + = @generic_file.name + +%p + %strong= t('generic_files.show.file_type') + ":" + = @generic_file.file_type + +%p + %strong= t('generic_files.show.file_size') + ":" + = number_to_human_size(@generic_file.file_size) + + += render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @parent, :child => @generic_file } \ No newline at end of file -- cgit v1.2.3 From f80fb1082eaf083557acd1fa92da4d2ffbfe1de9 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 26 Apr 2013 10:31:08 +0200 Subject: display download link --- app/views/generic_files/_index_core.html.haml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/views/generic_files') diff --git a/app/views/generic_files/_index_core.html.haml b/app/views/generic_files/_index_core.html.haml index 5fa66f7..3e21b30 100644 --- a/app/views/generic_files/_index_core.html.haml +++ b/app/views/generic_files/_index_core.html.haml @@ -9,6 +9,10 @@ %td= generic_file.category %td= generic_file.name %td= generic_file.file_type - + %td + %p + %a{:href => method( :"#{@parent.class.name.underscore}_generic_file_path" ).(@parent, generic_file, :format => generic_file.file_extension), :method => :get} + %i{:class => 'icon-download'} + = t("generic_files.index.actions.download") - =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => generic_file.owner, :child => generic_file} \ No newline at end of file + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => generic_file.owner, :child => generic_file} -- cgit v1.2.3 From 025c5730f7bc746687730044909652950ffb9b95 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 26 Apr 2013 10:31:45 +0200 Subject: display download link --- app/views/generic_files/show.html.haml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/views/generic_files') diff --git a/app/views/generic_files/show.html.haml b/app/views/generic_files/show.html.haml index b375dfc..9405444 100644 --- a/app/views/generic_files/show.html.haml +++ b/app/views/generic_files/show.html.haml @@ -16,5 +16,10 @@ %strong= t('generic_files.show.file_size') + ":" = number_to_human_size(@generic_file.file_size) +%p + %i{:class => 'icon-download'} + %strong= t('generic_files.index.actions.download') + ":" + %a{:href => method( :"#{@parent.class.name.underscore}_generic_file_path" ).(@parent, @generic_file, :format => @generic_file.file_extension), :method => :get} + = "#{@generic_file.name}.#{@generic_file.file_extension}" -= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @parent, :child => @generic_file } \ No newline at end of file += render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @parent, :child => @generic_file } -- cgit v1.2.3 From 5129d7701de57224030468ef547859f7b651a6cd Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 26 Apr 2013 10:45:18 +0200 Subject: parent fixed --- app/views/generic_files/_index_core.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/generic_files') diff --git a/app/views/generic_files/_index_core.html.haml b/app/views/generic_files/_index_core.html.haml index 3e21b30..b8ed1f6 100644 --- a/app/views/generic_files/_index_core.html.haml +++ b/app/views/generic_files/_index_core.html.haml @@ -11,7 +11,7 @@ %td= generic_file.file_type %td %p - %a{:href => method( :"#{@parent.class.name.underscore}_generic_file_path" ).(@parent, generic_file, :format => generic_file.file_extension), :method => :get} + %a{:href => method( :"#{generic_file.owner.class.name.underscore}_generic_file_path" ).(generic_file.owner, generic_file, :format => generic_file.file_extension), :method => :get} %i{:class => 'icon-download'} = t("generic_files.index.actions.download") -- cgit v1.2.3 From e1177a1d6ae27d3c23e3723fdea05c6ac2893294 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 26 Apr 2013 10:49:12 +0200 Subject: table headers --- app/views/generic_files/_index_core.html.haml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/views/generic_files') diff --git a/app/views/generic_files/_index_core.html.haml b/app/views/generic_files/_index_core.html.haml index b8ed1f6..2cea8a1 100644 --- a/app/views/generic_files/_index_core.html.haml +++ b/app/views/generic_files/_index_core.html.haml @@ -3,6 +3,8 @@ %th= t('generic_files.index.category') %th= t('generic_files.index.name') %th= t('generic_files.index.file_type') + %th + %th - for generic_file in generic_files %tr -- cgit v1.2.3