diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb
index 6c87193..3bec795 100644
--- a/app/controllers/admin/groups_controller.rb
+++ b/app/controllers/admin/groups_controller.rb
@@ -124,14 +124,14 @@ class Admin::GroupsController < OrbitGroupController
if !gpi.nil?
images << gpi
end
- end
+ end if !p[:group_post_images].nil?
files = []
p[:group_post_files].each do |id|
gpf = GroupPostFile.find(id) rescue nil
if !gpf.nil?
files << gpf
end
- end
+ end if !p[:group_post_files].nil?
p[:group_post_images] = images
p[:group_post_files] = files
p
@@ -147,6 +147,7 @@ class Admin::GroupsController < OrbitGroupController
def group_params
p = params.require(:group).permit!
+ p["user_ids"] = [] if p["user_ids"].nil?
p["user_ids"] << current_user.id.to_s
p["admins"] = []
p["admins"] << current_user.id.to_s
diff --git a/app/controllers/orbit_group_controller.rb b/app/controllers/orbit_group_controller.rb
index b169264..9a91144 100644
--- a/app/controllers/orbit_group_controller.rb
+++ b/app/controllers/orbit_group_controller.rb
@@ -19,7 +19,7 @@ class OrbitGroupController < ApplicationController
def set_access_rights
@access_right_level = "none"
- read_or_write = "write"
+ read_or_write = @group.permission rescue "read"
case params[:action]
when "show", "showpost", "newpost"
is_member = @group.users.include?(current_user)
diff --git a/app/models/group.rb b/app/models/group.rb
index cfd2053..dbe344f 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -7,6 +7,7 @@ class Group
field :description, localize: true
field :admins, type: Array, default: []
field :privacy, default: "closed"
+ field :permission, default: "write"
field :archive, type: Boolean, default: false
mount_uploader :image, ImageUploader
diff --git a/app/views/admin/groups/_group.html.erb b/app/views/admin/groups/_group.html.erb
index dbbfaf6..950ef4b 100644
--- a/app/views/admin/groups/_group.html.erb
+++ b/app/views/admin/groups/_group.html.erb
@@ -38,7 +38,9 @@
"><%= group.privacy %>
- <%= group.description %>
+ <% content = group.description %>
+ <%= content[0..250] %>
+ <%= "..." if content.length > 250 %>
diff --git a/app/views/admin/groups/_group_form.html.erb b/app/views/admin/groups/_group_form.html.erb
index 8cf585b..eae4c20 100644
--- a/app/views/admin/groups/_group_form.html.erb
+++ b/app/views/admin/groups/_group_form.html.erb
@@ -59,7 +59,7 @@
-
+
-
diff --git a/app/views/admin/groups/_post.html.erb b/app/views/admin/groups/_post.html.erb
index 5512d3d..c0a3333 100644
--- a/app/views/admin/groups/_post.html.erb
+++ b/app/views/admin/groups/_post.html.erb
@@ -28,19 +28,19 @@
- <% date = DateTime.parse(post.created_at.to_s).strftime("%d %B") %>
+ <% date = DateTime.parse(post.created_at.to_s).strftime("%d %B %H:%M") %>
<%= date %>
- 10:25
+
-
+
diff --git a/app/views/admin/groups/newpost.html.erb b/app/views/admin/groups/newpost.html.erb
index 30c4ab1..5c984ca 100644
--- a/app/views/admin/groups/newpost.html.erb
+++ b/app/views/admin/groups/newpost.html.erb
@@ -51,7 +51,11 @@
if(filesCount > 0){
doImagesUpload();
}else{
- doFilesUpload();
+ if(groupFilesDropzone.getQueuedFiles().length > 0){
+ doFilesUpload();
+ }else{
+ submitForm();
+ }
}
});
}
@@ -106,7 +110,13 @@
}
$("#create-post-form-btn").on("click",function(){
- doImagesUpload();
+ if(groupImageDropzone.getQueuedFiles().length > 0){
+ doImagesUpload();
+ }else if(groupFilesDropzone.getQueuedFiles().length > 0){
+ doFilesUpload();
+ }else{
+ submitForm();
+ }
// uploading all the files
$(".upload-status-notice")
.removeClass("hide")
@@ -118,6 +128,7 @@
if(groupImageDropzone.getQueuedFiles().length > 0 || groupFilesDropzone.getQueuedFiles().length > 0){
return false;
}else{
+ $(".upload-status-notice span.upload-text").text("Submitting");
$("form#new_group_post").submit();
return true;
}
diff --git a/app/views/admin/groups/show.html.erb b/app/views/admin/groups/show.html.erb
index 44688c0..2edd373 100644
--- a/app/views/admin/groups/show.html.erb
+++ b/app/views/admin/groups/show.html.erb
@@ -37,8 +37,8 @@
- - Home /
- - Another teacher group
+ - My Groups /
+ - <%= @group.title %>
Info
diff --git a/app/views/admin/groups/showpost.html.erb b/app/views/admin/groups/showpost.html.erb
index 57c7027..2add0c8 100644
--- a/app/views/admin/groups/showpost.html.erb
+++ b/app/views/admin/groups/showpost.html.erb
@@ -12,8 +12,9 @@
- - Home /
- - Another teacher group
+ - My Groups /
+ - <%= @group.title %> /
+ - <%= @post.title %>