diff --git a/app/assets/javascripts/controllers/projects.coffee.erb b/app/assets/javascripts/controllers/projects.coffee.erb index 07d386702..52db871c1 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 6648b9525..a91df72c8 100644 --- a/app/assets/templates/dashboard/projects.html.erb +++ b/app/assets/templates/dashboard/projects.html.erb @@ -9,10 +9,16 @@
+
+ {{ 'add_a_project' }} +
+
{{ '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/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/index.html.erb b/app/assets/templates/projects/index.html.erb index 221aa03fe..9e8ccf43a 100644 --- a/app/assets/templates/projects/index.html.erb +++ b/app/assets/templates/projects/index.html.erb @@ -94,10 +94,14 @@
-

{{ project.app_name }}

+

{{ project.app_name }}

{{project.name}}

+
+ {{ 'rough_draft' }} +
+
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/app/assets/templates/shared/publicProfile.html.erb b/app/assets/templates/shared/publicProfile.html.erb index 51773df6a..5545e6140 100644 --- a/app/assets/templates/shared/publicProfile.html.erb +++ b/app/assets/templates/shared/publicProfile.html.erb @@ -104,6 +104,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 bdc715b02..2bb02f670 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, :uid, :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, :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 + 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| 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 diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index a68216ce7..be2b1862d 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -125,7 +125,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 7cfa70309..f1a3b4a84 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -125,7 +125,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 3890f616a..e3a567458 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 5cd493971..fec13ce46 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"