xforum 0.0.374 → 0.0.375
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/xforum/forum_admin.js.coffee +69 -52
- data/app/assets/javascripts/xforum/forum_basic.js.coffee +23 -1
- data/app/assets/stylesheets/xforum/custom.css.scss +1 -1
- data/app/controllers/xforum/forums_controller.rb +4 -6
- data/app/models/xforum/category.rb +0 -1
- data/app/models/xforum/forum.rb +5 -6
- data/app/models/xforum/people_list.rb +42 -23
- data/app/views/xforum/admin_lists/_admin_users.html.erb +16 -7
- data/app/views/xforum/forums/_forum.html.erb +1 -1
- data/app/views/xforum/forums/_forum_admin.html.erb +1 -1
- data/db/migrate/20140826100001_add_private_to_people_lists.rb +5 -0
- data/lib/xforum/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ebc3a0dddf75b8269f9db96ef71e8741b2e99cb
|
4
|
+
data.tar.gz: 554035a6c0b42b7a4774977dac0840ec2ab9f597
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8fe36397028e44855d53468a58db90c8aac7df164177cb307f4141472d96938058b6d0682f95443eda73bf384bee06d8e8027411dcfa685f107a25d860dd79e
|
7
|
+
data.tar.gz: 86ecd69806c057a5ead2ddbcee3699e66113e0173a0d890d1b056ea47cc0f82af9bc29f876994e641e959e39e9badaec33796566f390fc764f998f882db80488
|
@@ -20,42 +20,30 @@ jQuery ->
|
|
20
20
|
$('#forum-box').delegate 'input[id = forum-admin-button]','click', (evt) ->
|
21
21
|
doButtonAction(event.target)
|
22
22
|
event.stopPropagation()
|
23
|
-
$('#forum-senate-admin-users').delegate '[id = forum-admin-list-option]','
|
24
|
-
|
23
|
+
$('#forum-senate-admin-users').delegate '[id = forum-admin-list-option]','dblclick', (evt) ->
|
24
|
+
addEmail(event.target)
|
25
25
|
$('#forum-senate-admin-lists').delegate '[id = set-moderation]','click', (evt) ->
|
26
26
|
changeModeration(event.target)
|
27
27
|
$('#forum-category-admin').change ->
|
28
28
|
getAdminsTopic()
|
29
|
+
$('#forum-every-list').change ->
|
30
|
+
setEditListUp(event.target)
|
29
31
|
$('#forum-actions').change ->
|
30
32
|
checkActionSetup(event.target)
|
31
33
|
$('#forum-admin-language-select').change ->
|
32
34
|
flipLanguage(event.target)
|
33
|
-
$('#forum-actions').change ->
|
34
|
-
handleActionChange(event.target)
|
35
35
|
$('#forum-category-monitor').change ->
|
36
36
|
monitorNewTopic()
|
37
37
|
$('#restrict-category').click ->
|
38
38
|
doRestrictCategory(event.target)
|
39
39
|
$('#restrict-topic').click ->
|
40
40
|
doRestrictTopic(event.target)
|
41
|
-
$('#
|
41
|
+
$('#forum-user-emails').dblclick ->
|
42
42
|
addEmail(event.target)
|
43
|
-
$('#users').dblclick ->
|
43
|
+
$('#forum-users-names').dblclick ->
|
44
44
|
addEmail(event.target)
|
45
45
|
#todo add reason selection for rejecion (forum and user privilages)
|
46
46
|
|
47
|
-
clearEmail=->
|
48
|
-
document.getElementById('forum_selected_emails').innerHTML=''
|
49
|
-
|
50
|
-
addEmail=(which)->
|
51
|
-
email_list=document.getElementById('forum_selected_emails')
|
52
|
-
emails=email_list.innerHTML
|
53
|
-
email=which.innerHTML
|
54
|
-
if emails.search(email)>=0
|
55
|
-
emails=emails.replace(email+',\n','')
|
56
|
-
else
|
57
|
-
emails=emails+email+',\n'
|
58
|
-
email_list.innerHTML=emails
|
59
47
|
|
60
48
|
doRestrictCategory=(button)->
|
61
49
|
if button.value== button.dataset.restrict
|
@@ -96,12 +84,6 @@ monitorNewTopic=->
|
|
96
84
|
getAdminCategory=->
|
97
85
|
document.getElementById('forum-category-admin').value
|
98
86
|
|
99
|
-
handleActionChange=(which)->
|
100
|
-
switch which.value
|
101
|
-
when 'send email to'
|
102
|
-
showMe({id:"forum-email-email"})
|
103
|
-
else
|
104
|
-
hideMe({id:"forum-email-email"})
|
105
87
|
|
106
88
|
doButtonAction = (which)->
|
107
89
|
switch(which.name)
|
@@ -139,12 +121,12 @@ window.doAdminStuff = ->
|
|
139
121
|
document.getElementById('forum-senate').dataset.admining = 'true'
|
140
122
|
setAdminDisplay()
|
141
123
|
clearEmail()
|
142
|
-
$.post('xforum/forum_ajax',{function:'get list',by_name:false, list:'admin-actions'},loadList)
|
143
|
-
$.post('xforum/forum_ajax',{function:'get list',by_name:false, list:'forum-distribution-lists'},loadList)
|
144
|
-
$.post('xforum/forum_ajax',{function:'get list',by_name:true,
|
145
|
-
$.post('xforum/forum_ajax',{function:'get list',by_name:true,
|
146
|
-
$.post('xforum/forum_ajax',{function:'get list',by_name:false, list:'forum-restricted-list'},loadList)
|
147
|
-
|
124
|
+
$.post('xforum/forum_ajax',{function:'get list', by_name:false, list:'admin-actions'},loadList)
|
125
|
+
$.post('xforum/forum_ajax',{function:'get list', by_name:false, list:'forum-distribution-lists'},loadList)
|
126
|
+
$.post('xforum/forum_ajax',{function:'get list', by_name:true, list:'forum-user-emails'},loadListPlus)
|
127
|
+
$.post('xforum/forum_ajax',{function:'get list', by_name:true, list:'forum-user-names'},loadListPlus)
|
128
|
+
$.post('xforum/forum_ajax',{function:'get list', by_name:false, list:'forum-restricted-list'},loadList)
|
129
|
+
$.post('xforum/forum_ajax',{function:'get list', by_name:false, list:'forum-every-list'},loadList)
|
148
130
|
|
149
131
|
setAdminDisplay=->
|
150
132
|
hideModerating()
|
@@ -157,28 +139,15 @@ setAdminDisplay=->
|
|
157
139
|
showMe({name: 'forum-user-email-show'})
|
158
140
|
hideMe({id:'forum-admin-topic'})
|
159
141
|
showMe({name: 'forum-user-tag-show'})
|
160
|
-
showMe({id:'forum-distribution-span'})
|
161
142
|
hideMe({id:'forum-moderator-add-span'})
|
162
143
|
hideMe({id:'forum-restricted-list'})
|
163
144
|
hideMe({name:'forum-act-on-admin-selector'})
|
164
|
-
document.getElementById('forum-new-
|
145
|
+
document.getElementById('forum-new-list').value=''
|
165
146
|
|
166
147
|
turnLanguage=(toggle)->
|
167
148
|
showMe({id:'language-selector-span'})
|
168
149
|
$.post('xforum/forum_ajax',{function:'get language set',list:'forum-admin-language-select',active:toggle =='off'},loadList)
|
169
150
|
|
170
|
-
setSelections = (which)->
|
171
|
-
if which.value == 'select none'
|
172
|
-
hideMe({obj:which.parentNode.parentNode})
|
173
|
-
name=which.parentNode.name + '-show'
|
174
|
-
showMe({name:name})
|
175
|
-
selections = getSelectValues({name:'forum-user-tag',ref:true})
|
176
|
-
selections= selections.concat(getSelectValues({name:'forum-user-email',ref:true}))
|
177
|
-
selector= $('[name=forum-email-selections]')
|
178
|
-
selector.children().remove()
|
179
|
-
for i in [0...selections.length]
|
180
|
-
unless selections[i]=='select none'
|
181
|
-
pushOption(selector,{value:selections[i]})
|
182
151
|
|
183
152
|
setEmailView = ->
|
184
153
|
blockMe({id:'forum-user-email-span'})
|
@@ -186,11 +155,16 @@ setEmailView = ->
|
|
186
155
|
$('#forum-user-email').focus()
|
187
156
|
|
188
157
|
setMonitorView=->
|
158
|
+
hideMe({id:'forum-every-list-span'})
|
189
159
|
hideMe({id:'forum-distribution-span'})
|
190
160
|
showMe({id:'forum-moderator-add-span'})
|
191
161
|
|
192
|
-
|
193
|
-
showMe({id:'forum-
|
162
|
+
setEveryListView=(which)->
|
163
|
+
showMe({id:'forum-every-list-span'})
|
164
|
+
if which=='edit list'
|
165
|
+
hideMe({id:'editing-every-list-entries'})
|
166
|
+
else
|
167
|
+
showMe({id:'editing-every-list-entries'})
|
194
168
|
hideMe({id:'forum-moderator-add-span'})
|
195
169
|
|
196
170
|
setTagView = ->
|
@@ -201,11 +175,20 @@ setTagView = ->
|
|
201
175
|
checkActionSetup = (which)->
|
202
176
|
showMe({name:'forum-act-on-admin-selector'})
|
203
177
|
switch which.value
|
204
|
-
when 'create
|
205
|
-
|
178
|
+
when 'create list','edit list'
|
179
|
+
setEveryListView(which.value)
|
206
180
|
when 'add topic monitor'
|
207
181
|
setMonitorView()
|
182
|
+
when 'send email to'
|
183
|
+
showMe({id:"forum-email-email"})
|
208
184
|
else
|
185
|
+
hideActionViews()
|
186
|
+
|
187
|
+
hideActionViews=->
|
188
|
+
hideMe({id:"forum-email-email"})
|
189
|
+
hideMe({id:'forum-every-list-span'})
|
190
|
+
hideMe({id:'forum-distribution-span'})
|
191
|
+
hideMe({id:'forum-moderator-add-span'})
|
209
192
|
|
210
193
|
flipLanguage=(selector)->
|
211
194
|
select = getSelectValues({obj:selector,ref:false})
|
@@ -213,20 +196,54 @@ flipLanguage=(selector)->
|
|
213
196
|
selector.selectedIndex=0
|
214
197
|
hideMe({id:'language-selector-span'})
|
215
198
|
|
199
|
+
setEditListUp=(selector) ->
|
200
|
+
the_list= getSelectValues({obj:selector,ref:false})[0]
|
201
|
+
$.post('xforum/forum_ajax',{function:'get this list',list_id:the_list},displayTheList)
|
202
|
+
|
203
|
+
displayTheList=(params)->
|
204
|
+
emails=''
|
205
|
+
for i in [0...params.list.length]
|
206
|
+
ref=forum_user_email_ids.indexOf(params.list[i] )
|
207
|
+
email=forum_user_emails[ref]
|
208
|
+
emails=emails+email+',\n'
|
209
|
+
document.getElementById('forum-selected-emails').innerHTML=emails
|
210
|
+
|
211
|
+
|
212
|
+
clearEmail=->
|
213
|
+
document.getElementById('forum-selected-emails').innerHTML=''
|
214
|
+
|
215
|
+
addEmail=(which)->
|
216
|
+
email_list=document.getElementById('forum-selected-emails')
|
217
|
+
emails=email_list.innerHTML
|
218
|
+
id=parseInt(which.value)
|
219
|
+
ref=0
|
220
|
+
if which.parentNode.name=='forum-user-emails'
|
221
|
+
email=which.innerHTML
|
222
|
+
else
|
223
|
+
ref=forum_user_email_ids.indexOf(id)
|
224
|
+
email=forum_user_emails[ref]
|
225
|
+
flashMe('alert','my email ' + id + ', ' + ref + ', ' + email)
|
226
|
+
|
227
|
+
if emails.search(email)>=0
|
228
|
+
emails=emails.replace(email+',\n','')
|
229
|
+
else
|
230
|
+
emails=emails+email+',\n'
|
231
|
+
email_list.innerHTML=emails
|
232
|
+
|
216
233
|
doAction = ->
|
217
234
|
request={}
|
218
235
|
request.function = 'forum admin action'
|
219
|
-
request.
|
220
|
-
request.users2 = getSelectValues({name:'forum-user-email',ref:false})
|
236
|
+
request.user_emails = document.getElementById('forum-selected-emails').innerHTML
|
221
237
|
request.subject = $('#forum-email-subject').val()
|
222
238
|
request.body= $('#forum-email-body').val()
|
223
239
|
request.topic=$('#forum-topic-monitor').val()
|
224
240
|
$('#forum-email-body').val('')
|
225
241
|
$('#forum-email-subject').val('')
|
226
|
-
request.new_list_name = $('#forum-new-
|
242
|
+
request.new_list_name = $('#forum-new-list').val()
|
227
243
|
request.distribution_list = $('#forum-distribution-lists').val()
|
244
|
+
request.the_list=$('#forum-every-list').val()
|
245
|
+
request.list_type=$('forum-list-type').val()
|
228
246
|
request.forum_action = $('#forum-actions').val()
|
229
|
-
request.emails=document.getElementById('forum_selected_emails').innerHTML
|
230
247
|
document.getElementById('forum-actions').selectedIndex=0
|
231
248
|
setAdminDisplay()
|
232
249
|
$("forum-email-body").val('')
|
@@ -57,6 +57,11 @@ playVideo=(params)->
|
|
57
57
|
|
58
58
|
|
59
59
|
window.startForum = ->
|
60
|
+
window.forum_user_emails=[]
|
61
|
+
window.forum_user_names=[]
|
62
|
+
window.forum_user_email_ids=[]
|
63
|
+
window.forum_user_name_ids=[]
|
64
|
+
|
60
65
|
hideMe({id: showPageName()})
|
61
66
|
showForumElements()
|
62
67
|
pages= document.getElementById('xforum-help-pages')
|
@@ -121,6 +126,12 @@ loadCustomList=(params)->
|
|
121
126
|
option.classList.add('drop-menu')
|
122
127
|
|
123
128
|
window.loadList = (params)->
|
129
|
+
loadListData(params,false)
|
130
|
+
|
131
|
+
window.loadListPlus = (params)->
|
132
|
+
loadListData(params,true)
|
133
|
+
|
134
|
+
window.loadListData=(params,global) ->
|
124
135
|
if params? && params.list_data?
|
125
136
|
list_data = params.list_data
|
126
137
|
if params.name != undefined
|
@@ -130,12 +141,23 @@ window.loadList = (params)->
|
|
130
141
|
else if params.obj !=undefined
|
131
142
|
selector=$(params.obj)
|
132
143
|
selector.children().remove()
|
144
|
+
switch selector[0].name
|
145
|
+
when 'forum-user-emails'
|
146
|
+
g_list=forum_user_emails
|
147
|
+
g_list_ids=forum_user_email_ids;
|
148
|
+
when 'forum-user-names'
|
149
|
+
g_list=forum_user_names
|
150
|
+
g_list_ids=forum_user_name_ids
|
151
|
+
|
133
152
|
if list_data.length==0
|
134
153
|
hideMe({obj:selector})
|
135
154
|
else
|
136
155
|
for i in [0...list_data.length]
|
137
156
|
unless list_data[i].state == 'closed'
|
138
157
|
pushOption(selector,list_data[i], 0)
|
158
|
+
if global
|
159
|
+
g_list.push(list_data[i].value)
|
160
|
+
g_list_ids.push(list_data[i].item)
|
139
161
|
|
140
162
|
window.pushOption = (q_selector,data,offset)->
|
141
163
|
selector=q_selector.get()[0]
|
@@ -148,7 +170,7 @@ window.pushOption = (q_selector,data,offset)->
|
|
148
170
|
option = document.createElement("option")
|
149
171
|
option.text = data.value
|
150
172
|
option.value = data.item
|
151
|
-
option.id = 'forum-
|
173
|
+
option.id = 'forum-admin-list-option'
|
152
174
|
ref = selector.children[selector.children.length - offset]
|
153
175
|
if ref==undefined
|
154
176
|
selector.appendChild(option)
|
@@ -5,6 +5,7 @@ module Xforum
|
|
5
5
|
class ForumsController < ApplicationController
|
6
6
|
|
7
7
|
def the_page
|
8
|
+
gon.forum_user=[]
|
8
9
|
end
|
9
10
|
|
10
11
|
def forum_ajax
|
@@ -13,14 +14,11 @@ module Xforum
|
|
13
14
|
case params[:list]
|
14
15
|
when 'admin-actions' then
|
15
16
|
render json: Forum.get_forum_actions(params, current_user)
|
16
|
-
when 'admin-users' then
|
17
|
-
render json: PeopleList.get_forum_users(params, current_user)
|
18
|
-
when 'admin-emails' then
|
19
|
-
render json: PeopleList.get_forum_emails(params, current_user)
|
20
|
-
when 'forum-distribution-lists', 'forum-restricted-list' then
|
21
|
-
render json: PeopleList.get_forum_distribution_lists(params,current_user)
|
22
17
|
else
|
18
|
+
render json: PeopleList.get_a_list(params,current_user)
|
23
19
|
end
|
20
|
+
when 'get this list'
|
21
|
+
render json: PeopleList.get_this_list(current_user,params)
|
24
22
|
when 'get video'
|
25
23
|
render json: Photo.get_video(params)
|
26
24
|
when 'forum admin action'
|
@@ -61,7 +61,6 @@ module Xforum
|
|
61
61
|
Category.create(name:'request new category',closed:false,suggestion:false)
|
62
62
|
Category.create(name:'select category',closed:false,suggestion:false)
|
63
63
|
end
|
64
|
-
|
65
64
|
params[:hold_test]=='true' ?
|
66
65
|
category_list= Category.grab({closed:false,suggestion:false},[:id,:name,:closed,:restricted,:is_moderated],{}) :
|
67
66
|
category_list= Category.grab('all',[:id,:name,:closed,:restricted,:is_moderated],{})
|
data/app/models/xforum/forum.rb
CHANGED
@@ -14,11 +14,10 @@ module Xforum
|
|
14
14
|
params[:users1]=[] if params[:users1].nil?
|
15
15
|
params[:users2]=[] if params[:users2].nil?
|
16
16
|
user_ids=[]
|
17
|
-
unless params[:
|
18
|
-
people_emails=params[:
|
17
|
+
unless params[:user_emails].nil?
|
18
|
+
people_emails=params[:user_emails].split(",\n")
|
19
19
|
people_emails.each{|email|user_ids.push(User.where(email:email).pluck(:id)[0] ) }
|
20
20
|
(0...user_ids.size).each{|i| user_ids[i]=user_ids[i].to_i}
|
21
|
-
user_ids.delete(0)
|
22
21
|
end
|
23
22
|
case params[:forum_action]
|
24
23
|
when 'suspend posting'
|
@@ -28,7 +27,7 @@ module Xforum
|
|
28
27
|
users_ids.each { |user_id| Xforum.user_class.where(id: user_id).update_all(forum_posting_priviages: false) }
|
29
28
|
when 'send email to'
|
30
29
|
UserMailer.note_to_forum_users(params, user_ids).deliver
|
31
|
-
when 'create
|
30
|
+
when 'create list', 'edit list'
|
32
31
|
PeopleList.manage_list(params, user_ids)
|
33
32
|
when 'add topic monitor'
|
34
33
|
Topic.add_topic_monitor(params, user_ids)
|
@@ -187,8 +186,8 @@ module Xforum
|
|
187
186
|
alist.push(['suspend posting',I18n.t('xForum.suspend_posting')])
|
188
187
|
alist.push(['suspend all',I18n.t('xForum.suspend_all')])
|
189
188
|
alist.push(['send email to',I18n.t('xForum.send_email_to')])
|
190
|
-
alist.push(['create
|
191
|
-
alist.push(['
|
189
|
+
alist.push(['create list',I18n.t('xForum.create_user_list')])
|
190
|
+
alist.push(['edit list',I18n.t('xForum.edit_user_list') ])
|
192
191
|
alist.push(['add topic monitor',I18n.t('xForum.Add_Topic_Monitor') ])
|
193
192
|
|
194
193
|
end
|
@@ -39,22 +39,33 @@ module Xforum
|
|
39
39
|
end
|
40
40
|
people
|
41
41
|
end
|
42
|
-
|
42
|
+
def self.get_a_list(params,current_user)
|
43
|
+
case params[:list]
|
44
|
+
when 'forum-user-names'
|
45
|
+
PeopleList.get_forum_users(params, current_user)
|
46
|
+
when 'forum-user-emails'
|
47
|
+
PeopleList.get_forum_emails(params, current_user)
|
48
|
+
when 'forum-distribution-lists', 'forum-restricted-list' ,'forum-every-list'
|
49
|
+
PeopleList.get_forum_people_lists(params,current_user)
|
50
|
+
else
|
51
|
+
end
|
52
|
+
end
|
43
53
|
def self.manage_list(params,user_ids)
|
44
54
|
case params[:forum_action]
|
45
|
-
when 'create
|
46
|
-
PeopleList.find_or_create_by(name:params[:new_list_name], list:
|
55
|
+
when 'create list'
|
56
|
+
PeopleList.find_or_create_by(name:params[:new_list_name], list:params[:list_type]){|list|
|
47
57
|
list.people=user_ids.to_json
|
48
58
|
}
|
49
|
-
when '
|
50
|
-
|
51
|
-
blist= JSON.load(PeopleList.where(id: params[:distribution_list]).pluck(:people)[0])
|
52
|
-
clist=(alist|blist)-(alist&blist)
|
53
|
-
PeopleList.where(id: params[:distribution_list]).update_all(people: clist.to_json)
|
59
|
+
when 'edit list'
|
60
|
+
PeopleList.where(id: params[:the_list]).update_all(people: user_ids.to_json)
|
54
61
|
else
|
55
62
|
end
|
56
63
|
end
|
57
|
-
|
64
|
+
def self.get_forum_emails(params, user)
|
65
|
+
user.forum_admin? ? alist=Xforum.user_class.all.order(:email).pluck(:email, :id) : alist= []
|
66
|
+
alist.unshift([I18n.t('xForum.select_none'), 'select none', 0])
|
67
|
+
{list_data:ForumAssist.named_array(alist, [:value, :item]), name:params[:list]}
|
68
|
+
end
|
58
69
|
def self.get_people_list(params)
|
59
70
|
which=PeopleList.get_which_owner(params)
|
60
71
|
params.merge!(which)
|
@@ -84,11 +95,6 @@ module Xforum
|
|
84
95
|
end
|
85
96
|
end
|
86
97
|
|
87
|
-
def self.get_forum_emails(params, user)
|
88
|
-
user.forum_admin? ? alist=Xforum.user_class.all.order(:email).pluck(:email, :id) : alist= []
|
89
|
-
alist.unshift([I18n.t('xForum.select_none'), 'select none', 0])
|
90
|
-
{list_data:ForumAssist.named_array(alist, [:value, :item]), name: 'forum-user-email'}
|
91
|
-
end
|
92
98
|
|
93
99
|
def self.get_forum_users(params, user)
|
94
100
|
user.forum_admin? ? alist = Xforum.user_class.all.order(:forum_post_name).pluck(:forum_post_name, :id) : alist =[]
|
@@ -96,10 +102,10 @@ module Xforum
|
|
96
102
|
blist=alist.clone #so you can do list.each and delete items
|
97
103
|
blist.each { |record| alist.delete(record) if record[0].nil? || record[0]=='' }
|
98
104
|
alist
|
99
|
-
{list_data: ForumAssist.named_array(alist, [:value, :item]), name:
|
105
|
+
{list_data: ForumAssist.named_array(alist, [:value, :item]), name: params[:list]}
|
100
106
|
end
|
101
107
|
|
102
|
-
def self.check_restrictions(blist,user, list_type)
|
108
|
+
def self.check_restrictions(blist, user, list_type)
|
103
109
|
alist=blist.clone #so you can do list.each and delete items
|
104
110
|
blist.each { |record|
|
105
111
|
alist.delete(record) if record[:restricted] && PeopleList.check_invitation(record[:id], user.id,list_type)
|
@@ -110,19 +116,32 @@ module Xforum
|
|
110
116
|
def self.check_invitation(id,user_id,list_type)
|
111
117
|
case list_type
|
112
118
|
when 'topic'
|
113
|
-
!JSON.load(PeopleList.where(topic_id:id,list:'invitation')[0].people).include?(user_id
|
119
|
+
!JSON.load(PeopleList.where(topic_id:id,list:'invitation')[0].people).include?(user_id)
|
114
120
|
when 'category', 'categories'
|
115
|
-
!JSON.load(PeopleList.where(category_id:id,list:'invitation')[0].people).include?(user_id
|
121
|
+
!JSON.load(PeopleList.where(category_id:id,list:'invitation')[0].people).include?(user_id)
|
116
122
|
when 'forum'
|
117
|
-
!JSON.load(PeopleList.where(forum_id:id,list:'invitation')[0].people).include?(user_id
|
123
|
+
!JSON.load(PeopleList.where(forum_id:id,list:'invitation')[0].people).include?(user_id)
|
118
124
|
end
|
119
125
|
end
|
120
|
-
def self.
|
121
|
-
|
122
|
-
|
126
|
+
def self.get_forum_people_lists(params,user)
|
127
|
+
case params[:list]
|
128
|
+
when 'forum-distribution-lists'
|
129
|
+
alist=PeopleList.where(list:'distribution list').pluck(:name, :id)
|
130
|
+
when 'forum-restricted-list'
|
131
|
+
alist=PeopleList.where(list:'invitation').pluck(:name, :id)
|
132
|
+
when 'forum-every-list'
|
133
|
+
alist=PeopleList.where(private:false).pluck(:name, :id)
|
134
|
+
else
|
135
|
+
end if user.forum_admin?
|
136
|
+
alist.unshift([I18n.t('xForum.select_list'), 'select list', 0]) unless alist.nil?
|
123
137
|
{list_data: ForumAssist.named_array(alist, [:value, :item]), id:params[:list]}
|
124
138
|
end
|
125
139
|
|
140
|
+
def self.get_this_list(user,params)
|
141
|
+
if user.forum_admin?
|
142
|
+
{list:JSON.load(PeopleList.find_by(id:params[:list_id].to_i).people)}
|
143
|
+
end
|
144
|
+
end
|
126
145
|
def self.is_a_moderator?(user_id)
|
127
146
|
the_lists=PeopleList.where(list: 'moderator').pluck(:people)
|
128
147
|
moderators=[]
|
@@ -137,7 +156,7 @@ module Xforum
|
|
137
156
|
invitees=PeopleList.get_people_id_list(user.id, params[:invitees])
|
138
157
|
peoplelist=PeopleList.where(list: 'invitation', owner_id: forum_id).first_or_create { |invitation|
|
139
158
|
invitation.owner_id=forum_id
|
140
|
-
invitation.list='
|
159
|
+
invitation.list='invitation'
|
141
160
|
}
|
142
161
|
peoplelist.invite_these_guys(invitees)
|
143
162
|
end
|
@@ -10,19 +10,28 @@
|
|
10
10
|
<span class="col-md-5">
|
11
11
|
<label> <%= t('xForum.User_Email')%> </label> <br><br>
|
12
12
|
<button class="cool-selector" name="forum-user-email-show"><input class= 'silver-selector' type='button' id= 'forum-admin-button' name='forum-user-email-choose' value="<%= t('xForum.select_user')%>"></button>
|
13
|
-
<span id='forum-user-email-span'><%=select_tag(:
|
13
|
+
<span id='forum-user-email-span'><%=select_tag(:forum_user_emails,options_for_select(@user_email), multiple:true, size:6, name:'forum-user-emails', class:'forum-select')%></span>
|
14
14
|
<br>
|
15
15
|
<label> <%= t('xForum.User_Name') %> </label> <br><br>
|
16
16
|
<button class="cool-selector" name="forum-user-tag-show"><input class= 'silver-selector' type='button' id= 'forum-admin-button' name='forum-user-tag-choose' value="<%= t('xForum.select_user')%>"></button>
|
17
|
-
<span id='forum-user-tag-span'><%=select_tag(:
|
17
|
+
<span id='forum-user-tag-span'><%=select_tag(:forum_users,options_for_select(@user_tags ), multiple:true, name:'forum-user-names',size:6, class:'forum-select')%></span>
|
18
18
|
</span>
|
19
19
|
<span class="col-md-4">
|
20
|
-
<span id="forum-
|
21
|
-
<label> <%= t('xForum.
|
22
|
-
<%=select_tag(:forum,options_for_select(@
|
23
|
-
<
|
20
|
+
<span id="forum-every-list-span" style="display:none">
|
21
|
+
<label> <%= t('xForum.forum_List_Name')%> </label>
|
22
|
+
<%=select_tag(:forum,options_for_select(@every_list), id:'forum-every-list', class:'forum-select')%> <br>
|
23
|
+
<span id="editing-every-list-entries">
|
24
|
+
<br><label><%=t('xForum.New')%></label> <input type="text" id='forum-new-list' class="admin-edit-field" >
|
25
|
+
<br><label><%=t('xForum.type')%></label> <input type="text" id='forum-list-type' class="admin-edit-field" >
|
26
|
+
|
27
|
+
</span>
|
28
|
+
|
24
29
|
<label><%=t('xFrorum.User_Email')%></label>
|
25
|
-
<textarea id="
|
30
|
+
<textarea id="forum-selected-emails" name="forum-selected-emails" readonly></textarea>
|
31
|
+
</span>
|
32
|
+
<span id="forum-distribution-span" style="display:none">
|
33
|
+
<%=select_tag(:forum,options_for_select(@every_list), id:'forum-distribution-lists', class:'forum-select')%>
|
34
|
+
</span>
|
26
35
|
<span id="forum-moderator-add-span">
|
27
36
|
<label> <%= t('xForum.Add_Topic_Monitor')%> </label> <br>
|
28
37
|
<%= select_tag(:forum, options_for_select(@categories),id:'forum-category-monitor', class: 'forum-select') %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%@forum_actions=[] %>
|
4
4
|
<%@user_tags=[] %>
|
5
5
|
<%@user_email=[]%>
|
6
|
-
<%@
|
6
|
+
<%@every_list=[] %>
|
7
7
|
<%if Xforum::Language.first.nil? then Xforum::Language.init_language_set end %>
|
8
8
|
<%unless ENV['XFORUM_LANGUAGES'].nil? then @languages= Xforum::Language.languages({active:'true',list:'forum-language'})[:list_data] end %>
|
9
9
|
<%@aphoto= 'photo' %>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%@categories2.pop%>
|
7
7
|
<%= select_tag(:forum, options_for_select(@categories2),id:'forum-category-admin', class: 'forum-select') %>
|
8
8
|
<%= select_tag(:forum, options_for_select(@topics),id:'forum-admin-topic', class: 'forum-select') %>
|
9
|
-
<%=select_tag(:forum,options_for_select(@
|
9
|
+
<%=select_tag(:forum,options_for_select(@every_list), id:'forum-restricted-list', class:'forum-select')%>
|
10
10
|
<div class="forum-row senate-row">
|
11
11
|
<%=render partial: 'xforum/admin_lists/admins_edit_lists'%>
|
12
12
|
<%=render partial: 'xforum/admin_lists/admins_suggestions_lists'%>
|
data/lib/xforum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xforum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.375
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert D Blanton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -252,6 +252,7 @@ files:
|
|
252
252
|
- db/migrate/20140603_change_suggestion_default.rb
|
253
253
|
- db/migrate/20140604_add_has_video_to_photo.rb
|
254
254
|
- db/migrate/20140813300_add_is_moderated_to_category_topics.rb
|
255
|
+
- db/migrate/20140826100001_add_private_to_people_lists.rb
|
255
256
|
- lib/active_record_extension.rb
|
256
257
|
- lib/tasks/xforum_tasks.rake
|
257
258
|
- lib/xforum.rb
|