From 31356a02f5d1d3fcf5db81ab599795988e1e8d5b Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 1 Jun 2016 10:38:42 +0200 Subject: [PATCH 001/366] [bug] projects drafts are shown on public profiles --- app/views/api/members/show.json.jbuilder | 58 +++++++++++++----------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/app/views/api/members/show.json.jbuilder b/app/views/api/members/show.json.jbuilder index 5c23588dd..5cbf22a40 100644 --- a/app/views/api/members/show.json.jbuilder +++ b/app/views/api/members/show.json.jbuilder @@ -1,3 +1,5 @@ +requested_current = (current_user and current_user.id == @member.id) + json.extract! @member, :id, :username, :email, :group_id, :slug, :invoicing_disabled, :is_allow_contact json.role @member.roles.first.name json.name @member.profile.full_name @@ -62,33 +64,35 @@ json.machine_credits @member.machine_credits do |mc| end json.last_sign_in_at @member.last_sign_in_at.iso8601 if @member.last_sign_in_at json.all_projects @member.all_projects do |project| - json.extract! project, :id, :name, :description, :author_id, :licence_id, :slug - json.url project_url(project, format: :json) - json.project_image project.project_image.attachment.large.url if project.project_image - json.machine_ids project.machine_ids - json.machines project.machines do |m| - json.id m.id - json.name m.name - end - json.author_id project.author_id - json.user_ids project.user_ids - json.component_ids project.component_ids - json.components project.components do |c| - json.id c.id - json.name c.name - end - json.project_users project.project_users do |pu| - json.id pu.user.id - json.first_name pu.user.profile.first_name - json.last_name pu.user.profile.last_name - json.full_name pu.user.profile.full_name - json.user_avatar do - json.id pu.user.profile.user_avatar.id - json.attachment_url pu.user.profile.user_avatar.attachment_url - end if pu.user.profile.user_avatar - json.username pu.user.username - json.is_valid pu.is_valid - json.valid_token pu.valid_token if !pu.is_valid and @member == pu.user + if requested_current || project.state == 'published' + json.extract! project, :id, :name, :description, :author_id, :licence_id, :slug + json.url project_url(project, format: :json) + json.project_image project.project_image.attachment.large.url if project.project_image + json.machine_ids project.machine_ids + json.machines project.machines do |m| + json.id m.id + json.name m.name + end + json.author_id project.author_id + json.user_ids project.user_ids + json.component_ids project.component_ids + json.components project.components do |c| + json.id c.id + json.name c.name + end + json.project_users project.project_users do |pu| + json.id pu.user.id + json.first_name pu.user.profile.first_name + json.last_name pu.user.profile.last_name + json.full_name pu.user.profile.full_name + json.user_avatar do + json.id pu.user.profile.user_avatar.id + json.attachment_url pu.user.profile.user_avatar.attachment_url + end if pu.user.profile.user_avatar + json.username pu.user.username + json.is_valid pu.is_valid + json.valid_token pu.valid_token if !pu.is_valid and @member == pu.user + end end end json.events_reservations @member.reservations.where(reservable_type: 'Event').joins(:slots).order('slots.start_at asc') do |r| From 306e0322c501b67ef585d6b8d1a41503b045b5e0 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 1 Jun 2016 10:47:00 +0200 Subject: [PATCH 002/366] [feature] display 'draft' badge on drafts --- app/assets/templates/dashboard/projects.html.erb | 4 +++- app/assets/templates/projects/index.html.erb | 4 ++++ app/assets/templates/shared/publicProfile.html.erb | 1 + app/views/api/members/show.json.jbuilder | 2 +- app/views/api/projects/index.json.jbuilder | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/assets/templates/dashboard/projects.html.erb b/app/assets/templates/dashboard/projects.html.erb index 6648b9525..82aac5b84 100644 --- a/app/assets/templates/dashboard/projects.html.erb +++ b/app/assets/templates/dashboard/projects.html.erb @@ -12,7 +12,9 @@
{{ 'you_dont_have_any_projects' }}
-

{{project.name}}

{{project.author_id == currentUser.id ? 'author' : 'collaborator' | translate}} +

{{project.name}}

+ {{project.author_id == currentUser.id ? 'author' : 'collaborator' | translate}} + {{ 'rough_draft' }} diff --git a/app/assets/templates/projects/index.html.erb b/app/assets/templates/projects/index.html.erb index 221aa03fe..e25616c51 100644 --- a/app/assets/templates/projects/index.html.erb +++ b/app/assets/templates/projects/index.html.erb @@ -98,6 +98,10 @@

{{project.name}}

+
+ {{ 'rough_draft' }} +
+
diff --git a/app/assets/templates/shared/publicProfile.html.erb b/app/assets/templates/shared/publicProfile.html.erb index 28a8b938a..314964309 100644 --- a/app/assets/templates/shared/publicProfile.html.erb +++ b/app/assets/templates/shared/publicProfile.html.erb @@ -103,6 +103,7 @@
{{project.author_id == user.id ? 'author' : 'collaborator' | translate}} + {{ 'rough_draft' }}
diff --git a/app/views/api/members/show.json.jbuilder b/app/views/api/members/show.json.jbuilder index 5cbf22a40..fd24ff97d 100644 --- a/app/views/api/members/show.json.jbuilder +++ b/app/views/api/members/show.json.jbuilder @@ -65,7 +65,7 @@ end json.last_sign_in_at @member.last_sign_in_at.iso8601 if @member.last_sign_in_at json.all_projects @member.all_projects do |project| if requested_current || project.state == 'published' - json.extract! project, :id, :name, :description, :author_id, :licence_id, :slug + json.extract! project, :id, :name, :description, :author_id, :licence_id, :slug, :state json.url project_url(project, format: :json) json.project_image project.project_image.attachment.large.url if project.project_image json.machine_ids project.machine_ids diff --git a/app/views/api/projects/index.json.jbuilder b/app/views/api/projects/index.json.jbuilder index 6f5e5e249..d9bfd00ed 100644 --- a/app/views/api/projects/index.json.jbuilder +++ b/app/views/api/projects/index.json.jbuilder @@ -1,5 +1,5 @@ json.projects @projects do |project| - json.extract! project, :id, :name, :description, :author_id, :licence_id, :slug + json.extract! project, :id, :name, :description, :author_id, :licence_id, :slug, :state json.url project_url(project, format: :json) json.project_image project.project_image.attachment.medium.url if project.project_image json.author_id project.author_id From 1bc9db2a6532c0c72b52358c9cea9e9cfc3839fd Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 1 Jun 2016 11:15:01 +0200 Subject: [PATCH 003/366] [feature] 'new project' button in dashboard/my projects --- app/assets/javascripts/controllers/projects.coffee.erb | 8 -------- app/assets/templates/dashboard/projects.html.erb | 4 ++++ app/assets/templates/projects/edit.html.erb | 2 +- app/assets/templates/projects/new.html.erb | 2 +- config/locales/app.public.en.yml | 1 - config/locales/app.public.fr.yml | 1 - config/locales/app.shared.en.yml | 1 + config/locales/app.shared.fr.yml | 1 + 8 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/controllers/projects.coffee.erb b/app/assets/javascripts/controllers/projects.coffee.erb index b9a2f2131..c4fa54d1d 100644 --- a/app/assets/javascripts/controllers/projects.coffee.erb +++ b/app/assets/javascripts/controllers/projects.coffee.erb @@ -74,14 +74,6 @@ class ProjectsController - ## - # Changes the user's view to the projects list page - ## - $scope.cancel = -> - $state.go('app.public.projects_list') - - - ## # For use with 'ng-class', returns the CSS class name for the uploads previews. # The preview may show a placeholder or the content of the file depending on the upload state. diff --git a/app/assets/templates/dashboard/projects.html.erb b/app/assets/templates/dashboard/projects.html.erb index 82aac5b84..a91df72c8 100644 --- a/app/assets/templates/dashboard/projects.html.erb +++ b/app/assets/templates/dashboard/projects.html.erb @@ -9,6 +9,10 @@
+ +
{{ 'you_dont_have_any_projects' }}
diff --git a/app/assets/templates/projects/edit.html.erb b/app/assets/templates/projects/edit.html.erb index cb17f767c..e5e1a4b53 100644 --- a/app/assets/templates/projects/edit.html.erb +++ b/app/assets/templates/projects/edit.html.erb @@ -7,7 +7,7 @@
- +
diff --git a/app/assets/templates/projects/new.html.erb b/app/assets/templates/projects/new.html.erb index 528eea6c2..13a5d4239 100644 --- a/app/assets/templates/projects/new.html.erb +++ b/app/assets/templates/projects/new.html.erb @@ -4,7 +4,7 @@
- +
diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index 73ddb1209..fd6a1867b 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -123,7 +123,6 @@ en: tooltip_openlab_projects_switch: "The search over the whole network lets you search over the projects of every Fab-manager using this feature !" openlab_search_not_available_at_the_moment: "Search over the whole network is not available at the moment. You still can search over the projects of this platform." project_search_result_is_empty: "Sorry, we found no results matching your search criteria." - add_a_project: "Add a project" reset_all_filters: "Reset all filters" search: "Search" all_projects: "All projects" diff --git a/config/locales/app.public.fr.yml b/config/locales/app.public.fr.yml index e973b6e34..54256300d 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -123,7 +123,6 @@ fr: tooltip_openlab_projects_switch: "La recherche sur tout le réseau vous permet de rechercher parmis les projets de tous les Fab-managers utilisant cette fonctionnalité !" openlab_search_not_available_at_the_moment: "La recherche sur tout le réseau n'est pas disponible pour le moment. Vous pouvez cependant effectuer une recherche parmis les projets de cette plateforme." project_search_result_is_empty: "Il n'y a pas de projets correspondant à vos critères de recherche." - add_a_project: "Ajouter un projet" reset_all_filters: "Réinitialiser tous les filtres" search: "Rechercher" all_projects: "Tous les projets" diff --git a/config/locales/app.shared.en.yml b/config/locales/app.shared.en.yml index c97ba5523..288639886 100644 --- a/config/locales/app.shared.en.yml +++ b/config/locales/app.shared.en.yml @@ -86,6 +86,7 @@ en: _click_on_the_synchronization_button_opposite_: "click on the synchronization button opposite" _disconnect_then_reconnect_: "disconnect then reconnect" _for_your_changes_to_take_effect: "for your changes to take effect." + add_a_project: "Add a project" messages: you_will_lose_any_unsaved_modification_if_you_quit_this_page: "You will lose any unsaved modification if you quit this page" diff --git a/config/locales/app.shared.fr.yml b/config/locales/app.shared.fr.yml index 9f773f22e..2d6d9e286 100644 --- a/config/locales/app.shared.fr.yml +++ b/config/locales/app.shared.fr.yml @@ -86,6 +86,7 @@ fr: _click_on_the_synchronization_button_opposite_: "cliquez sur le bouton de synchronisation ci-contre" _disconnect_then_reconnect_: "déconnectez-vous puis re-connectez vous" _for_your_changes_to_take_effect: "pour que les modifications soient prises en compte." + add_a_project: "Ajouter un projet" messages: you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Vous perdrez les modifications non enregistrées si vous quittez cette page" From 80e03916d9b05d9c7028759eff31b8273e68a77c Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 1 Jun 2016 11:29:23 +0200 Subject: [PATCH 004/366] [feature] display project origin even on origin platform --- app/assets/templates/projects/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/templates/projects/index.html.erb b/app/assets/templates/projects/index.html.erb index e25616c51..9e8ccf43a 100644 --- a/app/assets/templates/projects/index.html.erb +++ b/app/assets/templates/projects/index.html.erb @@ -94,7 +94,7 @@
-

{{ project.app_name }}

+

{{ project.app_name }}

{{project.name}}

From 525f46aba60d26a907a8e1cd7f1a798b8d34c822 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 1 Jun 2016 13:08:09 +0200 Subject: [PATCH 005/366] [feature] ability to use HTML in machine specs and description --- app/assets/javascripts/filters/filters.coffee | 15 ++++++++++++++- app/assets/templates/machines/_form.html.erb | 6 ++++-- app/assets/templates/machines/index.html.erb | 2 +- app/assets/templates/machines/show.html.erb | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/filters/filters.coffee b/app/assets/javascripts/filters/filters.coffee index 9b6334d91..2bd145688 100644 --- a/app/assets/javascripts/filters/filters.coffee +++ b/app/assets/javascripts/filters/filters.coffee @@ -98,10 +98,23 @@ Application.Filters.filter "humanize", [ -> Humanize.truncate(element, param, null) ] +## +# This filter will convert ASCII carriage-return character to the HTML break-line tag +## Application.Filters.filter "breakFilter", [ -> (text) -> if text != undefined - text.replace(/\n/g, '
') + text.replace(/\n+/g, '
') +] + +## +# This filter will take a HTML text as input and will return it without the html tags +## +Application.Filters.filter "simpleText", [ -> + (text) -> + if text != undefined + text = text.replace(//g, '\n') + text.replace(/<\/?\w+>/g, '') ] Application.Filters.filter "toTrusted", [ "$sce", ($sce) -> diff --git a/app/assets/templates/machines/_form.html.erb b/app/assets/templates/machines/_form.html.erb index 0aa424824..3f60f290f 100644 --- a/app/assets/templates/machines/_form.html.erb +++ b/app/assets/templates/machines/_form.html.erb @@ -46,7 +46,8 @@
- + + {{ 'description_is_required' }}
@@ -54,7 +55,8 @@
- + + {{ 'technical_specifications_are_required' }}
diff --git a/app/assets/templates/machines/index.html.erb b/app/assets/templates/machines/index.html.erb index f6804be64..2f08ecd20 100644 --- a/app/assets/templates/machines/index.html.erb +++ b/app/assets/templates/machines/index.html.erb @@ -35,7 +35,7 @@

{{machine.name}}

-

{{machine.description | humanize : 140 }}

+

-

{{machine.spec}}

+

From 0e6698a9ed37c0976ad5cf2796b8d8da274fda31 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 1 Jun 2016 13:53:55 +0200 Subject: [PATCH 006/366] fix short descriptions in machines index --- app/assets/javascripts/filters/filters.coffee | 2 +- app/assets/templates/machines/index.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/filters/filters.coffee b/app/assets/javascripts/filters/filters.coffee index 2bd145688..babeea9df 100644 --- a/app/assets/javascripts/filters/filters.coffee +++ b/app/assets/javascripts/filters/filters.coffee @@ -114,7 +114,7 @@ Application.Filters.filter "simpleText", [ -> (text) -> if text != undefined text = text.replace(//g, '\n') - text.replace(/<\/?\w+>/g, '') + text.replace(/<\/?\w+[^>]*>/g, '') ] Application.Filters.filter "toTrusted", [ "$sce", ($sce) -> diff --git a/app/assets/templates/machines/index.html.erb b/app/assets/templates/machines/index.html.erb index 2f08ecd20..e31795edb 100644 --- a/app/assets/templates/machines/index.html.erb +++ b/app/assets/templates/machines/index.html.erb @@ -35,7 +35,7 @@

{{machine.name}}

-

+