leangem 1.1.1 → 1.2.0
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/lib/fileupload.rb +4 -5
- data/lib/pager.rb +64 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9f9fc9b45ebad49274582dbae51b3c4059999a8
|
4
|
+
data.tar.gz: 1de7b6ca4b4936e8bb14abcf266a83354e74987d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 055668531270d1627430a0a014a93239771c2303fb6158bf42c9c041df32b6af14d6b2a265fa00761b73df74b829c7bf20206c39fe057b8028e228a7b98f952c
|
7
|
+
data.tar.gz: 5b557fe8ea067cf9d12b26f80cf0a53e5c18ec8dc7a3347d22a5cdd6aa6bec111b4716109d35abbc0287beddb6a23e64719460f3afbabf528a6176d8e8005deb
|
data/lib/fileupload.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
class Fileupload
|
2
|
-
def initialize(filepath="
|
2
|
+
def initialize(filepath="",min=1,max=4000)
|
3
3
|
@filepath=filepath
|
4
|
-
@format=format
|
5
4
|
@message=""
|
6
5
|
@minsize =min*1024
|
7
6
|
@maxsize=max*1024
|
@@ -19,13 +18,13 @@ class Fileupload
|
|
19
18
|
|
20
19
|
#大小限制,类型限制,都放进模型层中。
|
21
20
|
def img_validata(file)
|
22
|
-
img_for = /\.(
|
21
|
+
img_for = /\.(f4v|mp4|mp3)+$/.match(file.original_filename)
|
23
22
|
if img_for.nil? || img_for.blank?
|
24
|
-
@message="
|
23
|
+
@message="错误:影音文件格式不对,只允许上传f4v,mp4,mp3格式!\\n"
|
25
24
|
return false
|
26
25
|
end
|
27
26
|
if file.size<@minsize || file.size>@maxsize
|
28
|
-
@message="
|
27
|
+
@message="错误:影音文件大小错误,只允许#{@minsize}kb~#{@maxsize}kb!\\n"
|
29
28
|
return false
|
30
29
|
end
|
31
30
|
return true
|
data/lib/pager.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
class Pager
|
2
|
+
def initialize(dqyclass='page-navigator-current PNNW-S',aclass='page-navigator-number PNNW-S',
|
3
|
+
spageclass='page-navigator-prev',xpageclass='page-navigator-next',spagedis='page-navigator-prev-disable',
|
4
|
+
xpagedis='page-navigator-next-disable',dianclass='page-navigator-dots')
|
5
|
+
@dqyclass = dqyclass
|
6
|
+
@aclass = aclass
|
7
|
+
@spageclass = spageclass
|
8
|
+
@xpageclass = xpageclass
|
9
|
+
@spagedis = spagedis
|
10
|
+
@xpagedis = xpagedis
|
11
|
+
@dianclass = dianclass
|
12
|
+
end
|
13
|
+
def getpage(currentpage, pagecount, route)
|
14
|
+
shenglvhao = "<span class='#{@dianclass}'>...</span>"
|
15
|
+
syiye = currentpage>1 ? "<a class='#{@spageclass}' href='#{route}#{currentpage-1}'><上一页</a>" : "<span class='#{@spagedis}'><上一页</span>"
|
16
|
+
xyiye = currentpage<pagecount ? "<a class='#{@xpageclass}' href='#{route}#{currentpage+1}'>下一页></a>" : "<span class='#{@xpagedis}'><下一页</span>"
|
17
|
+
pages=""
|
18
|
+
if currentpage<7 && pagecount>10
|
19
|
+
for i in 1..9
|
20
|
+
if currentpage==i
|
21
|
+
pages += "<span class='#{@dqyclass}'>#{currentpage}</span>"
|
22
|
+
else
|
23
|
+
pages += "<a class='#{@aclass}' href='#{route}#{i}'>#{i}</a>"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
pages += shenglvhao
|
27
|
+
pages += "<a class='#{@aclass}' href='#{route}#{pagecount}'>#{pagecount}</a>"
|
28
|
+
elsif currentpage>=7 && currentpage<=pagecount-7
|
29
|
+
pages = "<a class='#{@aclass}' href='1'>1</a>"
|
30
|
+
pages += shenglvhao
|
31
|
+
pages += "<a class='#{@aclass}S' href='#{route}#{currentpage-4}'>#{currentpage-4}</a>"
|
32
|
+
pages += "<a class='#{@aclass}' href='#{route}#{currentpage-3}'>#{currentpage-3}</a>"
|
33
|
+
pages += "<a class='#{@aclass}' href='#{route}#{currentpage-2}'>#{currentpage-2}</a>"
|
34
|
+
pages += "<a class='#{@aclass}' href='#{route}#{currentpage-1}'>#{currentpage-1}</a>"
|
35
|
+
pages += "<span class='#{@dqyclass}'>#{currentpage}</span>"
|
36
|
+
pages += "<a class='#{@aclass}' href='#{route}#{currentpage+1}'>#{currentpage+1}</a>"
|
37
|
+
pages += "<a class='#{@aclass}' href='#{route}#{currentpage+2}'>#{currentpage+2}</a>"
|
38
|
+
pages += "<a class='#{@aclass}' href='#{route}#{currentpage+3}'>#{currentpage+3}</a>"
|
39
|
+
pages += "<a class='#{@aclass}' href='#{route}#{currentpage+4}'>#{currentpage+4}</a>"
|
40
|
+
pages += shenglvhao
|
41
|
+
pages += "<a class='#{@aclass}' href='#{route}#{pagecount}'>#{pagecount}</a>"
|
42
|
+
elsif currentpage>=7 && currentpage>pagecount-7
|
43
|
+
pages = "<a class='#{@aclass}' href='1'>1</a>"
|
44
|
+
pages += shenglvhao
|
45
|
+
for i in 1..9
|
46
|
+
fpage = pagecount-9+i
|
47
|
+
if currentpage == fpage
|
48
|
+
pages += "<span class='#{@dqyclass}'>#{currentpage}</span>"
|
49
|
+
else
|
50
|
+
pages += "<a class='#{@aclass}' href='#{route}#{fpage}'>#{fpage}</a>"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
elsif currentpage>0 && pagecount<=10
|
54
|
+
for i in 1..10
|
55
|
+
if currentpage==i
|
56
|
+
pages += "<span class='#{@dqyclass}'>#{currentpage}</span>"
|
57
|
+
else
|
58
|
+
pages += "<a class='#{@aclass}' href='#{route}#{i}'>#{i}</a>"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
syiye + pages +xyiye
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leangem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lean
|
@@ -19,6 +19,7 @@ files:
|
|
19
19
|
- lib/imageupload.rb
|
20
20
|
- lib/fileupload.rb
|
21
21
|
- lib/vcode.rb
|
22
|
+
- lib/pager.rb
|
22
23
|
homepage: http://rubygems.org/gems/imageupload
|
23
24
|
licenses:
|
24
25
|
- Lean
|