From 02a0cbb6bbe21b7b3183736e05905d0668640d0a Mon Sep 17 00:00:00 2001 From: Azareal Date: Sat, 29 Jul 2017 11:36:39 +0100 Subject: [PATCH] More work on the Shadow theme. Switched gopsutil with a temporary more stable fork. Ping PostgreSQL upon connecting. We need a global solution for connection drops. A connection timeout, perhaps? Added the rowmenu CSS class for styling sidebar menus. Added the real_first_child CSS class, we might be able to get around using it by redoing the
nesting. Added the rowlist CSS class. Added the bgavatars CSS class. Added avatars to the User Manager. Added limited responsivity to the Shadow Theme, I might have broken some things in the other themes, I'll fix that soon! A per-theme post-avatar-bg.jpg file is now used for the first topic layout rather than the global white-dot.jpg file. --- README.md | 12 +- install-gosora-linux | 4 +- install.bat | 2 +- mysql.sql | 4 +- pgsql.go | 6 + plugin_socialgroups.go | 2 +- public/rgb_105_105_105.jpg | Bin 0 -> 538 bytes public/rgb_71_71_71.jpg | Bin 0 -> 539 bytes public/rgb_95_95_95.jpg | Bin 0 -> 539 bytes template_list.go | 306 ++++++++--------- template_topic.go | 189 +++++------ templates.go | 38 +++ templates/account-menu.html | 2 +- templates/account-own-edit-avatar.html | 2 +- templates/account-own-edit-email.html | 1 + templates/account-own-edit-username.html | 4 +- templates/account-own-edit.html | 4 +- templates/create-topic.html | 7 +- templates/forum.html | 4 +- templates/menu.html | 12 +- templates/panel-adminlogs.html | 4 +- templates/panel-forum-edit.html | 5 +- templates/panel-forums.html | 2 +- templates/panel-group-edit-perms.html | 10 +- templates/panel-group-edit.html | 2 +- templates/panel-groups.html | 2 +- templates/panel-inner-menu.html | 2 +- templates/panel-modlogs.html | 4 +- templates/panel-settings.html | 2 +- templates/panel-themes.html | 2 +- templates/panel-users.html | 6 +- templates/profile.html | 89 ++--- templates/topic.html | 32 +- themes.go | 2 + themes/cosmo-conflux/public/main.css | 8 +- themes/cosmo/public/main.css | 8 +- themes/shadow/DEVELOPERS.md | 4 + themes/shadow/public/main.css | 313 +++++++++++++++++- themes/shadow/public/panel.css | 24 ++ themes/shadow/public/post-avatar-bg.jpg | Bin 0 -> 539 bytes themes/tempra-conflux/public/main.css | 13 + themes/tempra-cursive/DEVELOPERS.md | 4 + themes/tempra-cursive/public/main.css | 27 +- .../tempra-cursive/public/post-avatar-bg.jpg | Bin 0 -> 539 bytes themes/tempra-simple/DEVELOPERS.md | 4 + themes/tempra-simple/public/main.css | 16 +- .../tempra-simple/public/post-avatar-bg.jpg | Bin 0 -> 539 bytes update-deps-linux | 2 +- update-deps.bat | 2 +- 49 files changed, 813 insertions(+), 375 deletions(-) create mode 100644 public/rgb_105_105_105.jpg create mode 100644 public/rgb_71_71_71.jpg create mode 100644 public/rgb_95_95_95.jpg create mode 100644 themes/shadow/DEVELOPERS.md create mode 100644 themes/shadow/public/post-avatar-bg.jpg create mode 100644 themes/tempra-cursive/DEVELOPERS.md create mode 100644 themes/tempra-cursive/public/post-avatar-bg.jpg create mode 100644 themes/tempra-simple/DEVELOPERS.md create mode 100644 themes/tempra-simple/public/post-avatar-bg.jpg diff --git a/README.md b/README.md index 78051c14..d29f5950 100644 --- a/README.md +++ b/README.md @@ -88,16 +88,18 @@ Several important features for saving memory in the templates system may have to An example of running the commands directly on Windows. -Linux is similar, however you might need to use cd and mv a bit more like in the shell files due to the differences in go build across platforms. +Linux is similar, however you might need to use cd and mv a bit more like in the shell files due to the differences in go build across platforms. Additionally, Linux doesn't require `StackExchange/wmi` or ``/x/sys/windows` ```bash +git clone https://github.com/Azareal/Gosora + go get -u github.com/go-sql-driver/mysql go get -u golang.org/x/crypto/bcrypt go get -u github.com/StackExchange/wmi -go get -u github.com/shirou/gopsutil +go get -u github.com/Azareal/gopsutil go get -u github.com/gorilla/websocket @@ -162,11 +164,11 @@ We're looking for ways to clean-up the plugin system so that all of them (except * golang.org/x/crypto/bcrypt For hashing passwords. -* github.com/shirou/gopsutil For pulling information on CPU and memory usage. +* github.com/Azareal/gopsutil For pulling information on CPU and memory usage. I've temporarily forked this, as we were having stability issues with the latest build. * github.com/StackExchange/wmi Dependency for gopsutil on Windows. - - * golang.org/x/sys/windows Also a dependency for gopsutil on Windows. + + * golang.org/x/sys/windows Also a dependency for gopsutil on Windows. This isn't needed at the moment, as I've rolled things back to an older more stable build. * github.com/gorilla/websocket Needed for Gosora's Optional WebSockets Module. diff --git a/install-gosora-linux b/install-gosora-linux index ead6a1d4..86449706 100644 --- a/install-gosora-linux +++ b/install-gosora-linux @@ -5,7 +5,7 @@ go get -u github.com/lib/pq echo "Installing bcrypt" go get -u golang.org/x/crypto/bcrypt echo "Installing gopsutil" -go get -u github.com/shirou/gopsutil +go get -u github.com/Azareal/gopsutil echo "Installing Gorilla WebSockets" go get -u github.com/gorilla/websocket @@ -17,4 +17,4 @@ mv ./Install .. cd .. echo "Running the installer" -./Install \ No newline at end of file +./Install diff --git a/install.bat b/install.bat index 9cc62203..1a66b5f3 100644 --- a/install.bat +++ b/install.bat @@ -29,7 +29,7 @@ if %errorlevel% neq 0 ( exit /b %errorlevel% ) echo Installing the gopsutil library -go get -u github.com/shirou/gopsutil +go get -u github.com/Azareal/gopsutil if %errorlevel% neq 0 ( pause exit /b %errorlevel% diff --git a/mysql.sql b/mysql.sql index 6dd1da08..047ff7aa 100644 --- a/mysql.sql +++ b/mysql.sql @@ -71,7 +71,9 @@ CREATE TABLE `replies`( `createdAt` datetime not null, `createdBy` int not null, `lastEdit` int not null, - `lastEditBy` int not null, + `lastEditBy` int not null, /* Do we need this? */ + /*`editIndex` int not null,*/ /* For append edits, e.g. auto-merges? Is this enough for this feature? */ + `lastUpdated` datetime not null, `ipaddress` varchar(200) DEFAULT '0.0.0.0.0' not null, `likeCount` int DEFAULT 0 not null, `words` int DEFAULT 1 not null, diff --git a/pgsql.go b/pgsql.go index e51118ca..05300d9a 100644 --- a/pgsql.go +++ b/pgsql.go @@ -29,6 +29,12 @@ func _init_database() (err error) { return err } + // Make sure that the connection is alive + err = db.Ping() + if err != nil { + return err + } + // Fetch the database version db.QueryRow("SELECT VERSION()").Scan(&db_version) diff --git a/plugin_socialgroups.go b/plugin_socialgroups.go index 9b228190..dee9f633 100644 --- a/plugin_socialgroups.go +++ b/plugin_socialgroups.go @@ -190,7 +190,7 @@ func install_socialgroups() error { qgen.DB_Table_Column{"joinable","smallint",0,false,false,"0"}, qgen.DB_Table_Column{"owner","int",0,false,false,""}, qgen.DB_Table_Column{"memberCount","int",0,false,false,""}, - qgen.DB_Table_Column{"mainForum","int",0,false,false,"0"}, // The board the user lands on when they click ona group, we'll make it possible for group admins to change what users land on + qgen.DB_Table_Column{"mainForum","int",0,false,false,"0"}, // The board the user lands on when they click on a group, we'll make it possible for group admins to change what users land on //qgen.DB_Table_Column{"boards","varchar",255,false,false,""}, // Cap the max number of boards at 8 to avoid overflowing the confines of a 64-bit integer? qgen.DB_Table_Column{"backdrop","varchar",200,false,false,""}, // File extension for the uploaded file, or an external link qgen.DB_Table_Column{"createdAt","createdAt",0,false,false,""}, diff --git a/public/rgb_105_105_105.jpg b/public/rgb_105_105_105.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8b12065f742458054f468f9d3c734c497c6b1904 GIT binary patch literal 538 zcmb7e8HK7J`2ucm*LsvJC@SdX(HHV_ximG+wcuMAJ4{sh%l80;Rm{-*Y&DdKMmhrn&;tUwpfNQ7=czQjwq3#lqg9k zZ?{{i&8;=LF-6(oqI9J(++)}ERaM!C{-Eav9bftQ32N~qlo4gVFoplO!Uwn%5KyB7 ztnn70eu1kIt@;>o6~Ov& WbLtFQj^Xz^mH1wzBXA>8fZYKxA4#tO literal 0 HcmV?d00001 diff --git a/public/rgb_71_71_71.jpg b/public/rgb_71_71_71.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3862da09c104c20f681fc1d3b470b7a2c177f81a GIT binary patch literal 539 zcmb7(%(_VRJvenavmR0~2VaQj0QaQy7zF zrp)tB;Y#OhX>C>axvG6_Ef3ibLen&^cQG1x9U(0{ndutS4VA6J*^1Bb1qh_c zLwVAk;tPUI{whyX`RSkHJDesc)(p^fn<(B#6|zf4Z4==41DdF%V}SYv4q9~Doy9?b Z+Nuz5$;gNuvM& literal 0 HcmV?d00001 diff --git a/public/rgb_95_95_95.jpg b/public/rgb_95_95_95.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4053030aa46c61fe045b7ac8fa5ebc4baf6a384b GIT binary patch literal 539 zcmb7fM@Y*~X8OkTLuIS*Z^cLW0tC|J zp*(3%@d-gDzm=z{{Paih6;2ZrYX<0in<(B#6|zf4eF1(ypov=Q0@M$1&?0Yl76$=p Z&$i#8q2(JsO_@6)@v%rdpu + `) var menu_2 []byte = []byte(` @@ -54,12 +60,6 @@ var menu_8 []byte = []byte(` `) var menu_9 []byte = []byte(` - @@ -73,155 +73,158 @@ var header_11 []byte = []byte(`> `) var header_12 []byte = []byte(`
`) var header_13 []byte = []byte(`
`) -var topic_0 []byte = []byte(``) -var topic_3 []byte = []byte(` +var topic_0 []byte = []byte(` + + +`) +var topic_2 []byte = []byte(``) +var topic_5 []byte = []byte(`
> +var topic_8 []byte = []byte(`?page=`) +var topic_9 []byte = []byte(`">>
`) -var topic_8 []byte = []byte(` +var topic_10 []byte = []byte(`
- -
- `) -var topic_13 []byte = []byte(` - `) -var topic_14 []byte = []byte(`🔒︎`) -var topic_15 []byte = []byte(` - - `) -var topic_17 []byte = []byte(``) -var topic_18 []byte = []byte(` - - `) +
+ `) +var topic_14 []byte = []byte(` + `) +var topic_15 []byte = []byte(`🔒︎`) +var topic_16 []byte = []byte(` + + `) +var topic_18 []byte = []byte(``) var topic_19 []byte = []byte(` -
- + + `) +var topic_20 []byte = []byte(` +
+
+var topic_21 []byte = []byte(`" style="`) +var topic_22 []byte = []byte(`background-image:url(`) +var topic_23 []byte = []byte(`), url(/static/post-avatar-bg.jpg);background-position: 0px `) +var topic_24 []byte = []byte(`-1`) +var topic_25 []byte = []byte(`0px;background-repeat:no-repeat, repeat-y;`) +var topic_26 []byte = []byte(`">

`) -var topic_26 []byte = []byte(`

+var topic_27 []byte = []byte(`

+var topic_28 []byte = []byte(` `) -var topic_30 []byte = []byte(`   +var topic_29 []byte = []byte(`.`) +var topic_30 []byte = []byte(`" class="username real_username">`) +var topic_31 []byte = []byte(`   `) -var topic_31 []byte = []byte(` +var topic_32 []byte = []byte(` `) -var topic_35 []byte = []byte(``) -var topic_37 []byte = []byte(``) -var topic_39 []byte = []byte(``) -var topic_41 []byte = []byte(``) -var topic_43 []byte = []byte(` +var topic_34 []byte = []byte(`background-color:/*#eaffea*/#D6FFD6;`) +var topic_35 []byte = []byte(`">`) +var topic_36 []byte = []byte(``) +var topic_38 []byte = []byte(``) +var topic_40 []byte = []byte(``) +var topic_42 []byte = []byte(``) +var topic_44 []byte = []byte(` +var topic_45 []byte = []byte(`?session=`) +var topic_46 []byte = []byte(`&type=topic" class="mod_button report_item" style="font-weight:normal;" title="Flag Topic"> `) -var topic_46 []byte = []byte(``) -var topic_48 []byte = []byte(``) -var topic_49 []byte = []byte(``) -var topic_50 []byte = []byte(``) -var topic_51 []byte = []byte(``) -var topic_52 []byte = []byte(` +var topic_47 []byte = []byte(``) +var topic_49 []byte = []byte(``) +var topic_50 []byte = []byte(``) +var topic_51 []byte = []byte(``) +var topic_52 []byte = []byte(``) +var topic_53 []byte = []byte(`
`) -var topic_53 []byte = []byte(` +var topic_54 []byte = []byte(`
`) -var topic_54 []byte = []byte(` - `) var topic_55 []byte = []byte(` + `) +var topic_56 []byte = []byte(`
`) -var topic_56 []byte = []byte(` +var topic_57 []byte = []byte(`
+var topic_58 []byte = []byte(`" style="`) +var topic_59 []byte = []byte(`background-image:url(`) +var topic_60 []byte = []byte(`), url(/static/post-avatar-bg.jpg);background-position: 0px `) +var topic_61 []byte = []byte(`-1`) +var topic_62 []byte = []byte(`0px;background-repeat:no-repeat, repeat-y;`) +var topic_63 []byte = []byte(`">

`) -var topic_63 []byte = []byte(`

+var topic_64 []byte = []byte(`

`) -var topic_66 []byte = []byte(`   +var topic_65 []byte = []byte(`.`) +var topic_66 []byte = []byte(`" class="username real_username">`) +var topic_67 []byte = []byte(`   `) -var topic_67 []byte = []byte(``) -var topic_71 []byte = []byte(``) -var topic_73 []byte = []byte(``) -var topic_75 []byte = []byte(` +var topic_68 []byte = []byte(``) +var topic_72 []byte = []byte(``) +var topic_74 []byte = []byte(``) +var topic_76 []byte = []byte(` +var topic_77 []byte = []byte(`?session=`) +var topic_78 []byte = []byte(`&type=reply" class="mod_button report_item" title="Flag Reply"> `) -var topic_78 []byte = []byte(``) -var topic_80 []byte = []byte(``) -var topic_81 []byte = []byte(``) -var topic_82 []byte = []byte(``) -var topic_83 []byte = []byte(``) -var topic_84 []byte = []byte(` +var topic_79 []byte = []byte(``) +var topic_81 []byte = []byte(``) +var topic_82 []byte = []byte(``) +var topic_83 []byte = []byte(``) +var topic_84 []byte = []byte(``) +var topic_85 []byte = []byte(`
`) -var topic_85 []byte = []byte(`
+var topic_86 []byte = []byte(` `) -var topic_86 []byte = []byte(` +var topic_87 []byte = []byte(`
+var topic_88 []byte = []byte(`' type="hidden" />
@@ -410,24 +413,28 @@ var topic_alt_89 []byte = []byte(`' type="hidden" /> `) var profile_0 []byte = []byte(` -
-
- -
-
- `) +
+ +
+
+ +
+
+ `) var profile_2 []byte = []byte(``) var profile_3 []byte = []byte(``) var profile_4 []byte = []byte(``) var profile_5 []byte = []byte(` -
- - `) -var profile_6 []byte = []byte(`
+
+ `) +var profile_6 []byte = []byte(`
+ `) var profile_7 []byte = []byte(`Unban @@ -436,67 +443,70 @@ var profile_10 []byte = []byte(`Ban`) var profile_13 []byte = []byte(` -
`) +
`) var profile_14 []byte = []byte(` -
- -
`) +
+
+ +
+
`) var profile_17 []byte = []byte(` -
- `) + `) var profile_24 []byte = []byte(`

- `) var profile_27 []byte = []byte(`   - `) + `) var profile_28 []byte = []byte(` - `) var profile_31 []byte = []byte(` - - `) -var profile_34 []byte = []byte(``) + `) +var profile_34 []byte = []byte(``) var profile_35 []byte = []byte(``) var profile_36 []byte = []byte(` -
-`) +
+ `) var profile_37 []byte = []byte(`
-
`) var profile_38 []byte = []byte(` - - -
-
-
-
-
-
- +
+
+
+
+
+
+
+
+ `) var profile_40 []byte = []byte(`
@@ -607,9 +617,9 @@ var forum_11 []byte = []byte(` `) var forum_12 []byte = []byte(` +var forum_13 []byte = []byte(`">
`) -var forum_14 []byte = []byte(`
🔒︎
`) +var forum_14 []byte = []byte(`
`) var forum_15 []byte = []byte(`
`) diff --git a/template_topic.go b/template_topic.go index 65edc6b7..6b749b2c 100644 --- a/template_topic.go +++ b/template_topic.go @@ -66,199 +66,200 @@ w.Write([]byte(item)) w.Write(header_13) } } -if tmpl_topic_vars.Page > 1 { w.Write(topic_0) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_1) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1))) +if tmpl_topic_vars.Page > 1 { w.Write(topic_2) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_3) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1))) +w.Write(topic_4) } if tmpl_topic_vars.LastPage != tmpl_topic_vars.Page { -w.Write(topic_3) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) -w.Write(topic_4) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1))) w.Write(topic_5) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_6) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1))) w.Write(topic_7) -} -w.Write(topic_8) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_8) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1))) w.Write(topic_9) -if tmpl_topic_vars.Topic.Sticky { +} w.Write(topic_10) +if tmpl_topic_vars.Topic.Sticky { +w.Write(topic_11) } else { if tmpl_topic_vars.Topic.Is_Closed { -w.Write(topic_11) -} -} w.Write(topic_12) -w.Write([]byte(tmpl_topic_vars.Topic.Title)) +} +} w.Write(topic_13) -if tmpl_topic_vars.Topic.Is_Closed { +w.Write([]byte(tmpl_topic_vars.Topic.Title)) w.Write(topic_14) +if tmpl_topic_vars.Topic.Is_Closed { +w.Write(topic_15) } if tmpl_topic_vars.CurrentUser.Perms.EditTopic { -w.Write(topic_15) -w.Write([]byte(tmpl_topic_vars.Topic.Title)) w.Write(topic_16) -if tmpl_topic_vars.CurrentUser.Perms.CloseTopic { +w.Write([]byte(tmpl_topic_vars.Topic.Title)) w.Write(topic_17) -} +if tmpl_topic_vars.CurrentUser.Perms.CloseTopic { w.Write(topic_18) } w.Write(topic_19) -w.Write([]byte(tmpl_topic_vars.Topic.ClassName)) -w.Write(topic_20) -if tmpl_topic_vars.Topic.Avatar != "" { -w.Write(topic_21) -w.Write([]byte(tmpl_topic_vars.Topic.Avatar)) -w.Write(topic_22) -if tmpl_topic_vars.Topic.ContentLines <= 5 { -w.Write(topic_23) } +w.Write(topic_20) +w.Write([]byte(tmpl_topic_vars.Topic.ClassName)) +w.Write(topic_21) +if tmpl_topic_vars.Topic.Avatar != "" { +w.Write(topic_22) +w.Write([]byte(tmpl_topic_vars.Topic.Avatar)) +w.Write(topic_23) +if tmpl_topic_vars.Topic.ContentLines <= 5 { w.Write(topic_24) } w.Write(topic_25) -w.Write([]byte(tmpl_topic_vars.Topic.Content)) +} w.Write(topic_26) w.Write([]byte(tmpl_topic_vars.Topic.Content)) w.Write(topic_27) -w.Write([]byte(tmpl_topic_vars.Topic.UserSlug)) +w.Write([]byte(tmpl_topic_vars.Topic.Content)) w.Write(topic_28) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy))) +w.Write([]byte(tmpl_topic_vars.Topic.UserSlug)) w.Write(topic_29) -w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName)) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy))) w.Write(topic_30) -if tmpl_topic_vars.CurrentUser.Perms.LikeItem { +w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName)) w.Write(topic_31) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +if tmpl_topic_vars.CurrentUser.Perms.LikeItem { w.Write(topic_32) -if tmpl_topic_vars.Topic.Liked { +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_33) -} +if tmpl_topic_vars.Topic.Liked { w.Write(topic_34) } -if tmpl_topic_vars.CurrentUser.Perms.EditTopic { w.Write(topic_35) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +} +if tmpl_topic_vars.CurrentUser.Perms.EditTopic { w.Write(topic_36) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_37) } if tmpl_topic_vars.CurrentUser.Perms.DeleteTopic { -w.Write(topic_37) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_38) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_39) } if tmpl_topic_vars.CurrentUser.Perms.PinTopic { if tmpl_topic_vars.Topic.Sticky { -w.Write(topic_39) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_40) -} else { +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_41) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +} else { w.Write(topic_42) -} -} -w.Write(topic_43) w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_43) +} +} w.Write(topic_44) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) w.Write(topic_45) -if tmpl_topic_vars.Topic.LikeCount > 0 { +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) w.Write(topic_46) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount))) +if tmpl_topic_vars.Topic.LikeCount > 0 { w.Write(topic_47) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount))) +w.Write(topic_48) } if tmpl_topic_vars.Topic.Tag != "" { -w.Write(topic_48) -w.Write([]byte(tmpl_topic_vars.Topic.Tag)) w.Write(topic_49) -} else { +w.Write([]byte(tmpl_topic_vars.Topic.Tag)) w.Write(topic_50) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level))) +} else { w.Write(topic_51) -} +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level))) w.Write(topic_52) +} +w.Write(topic_53) if len(tmpl_topic_vars.ItemList) != 0 { for _, item := range tmpl_topic_vars.ItemList { if item.ActionType != "" { -w.Write(topic_53) -w.Write([]byte(item.ActionIcon)) w.Write(topic_54) -w.Write([]byte(item.ActionType)) +w.Write([]byte(item.ActionIcon)) w.Write(topic_55) -} else { +w.Write([]byte(item.ActionType)) w.Write(topic_56) -w.Write([]byte(item.ClassName)) +} else { w.Write(topic_57) -if item.Avatar != "" { +w.Write([]byte(item.ClassName)) w.Write(topic_58) -w.Write([]byte(item.Avatar)) +if item.Avatar != "" { w.Write(topic_59) -if item.ContentLines <= 5 { +w.Write([]byte(item.Avatar)) w.Write(topic_60) -} +if item.ContentLines <= 5 { w.Write(topic_61) } w.Write(topic_62) -w.Write([]byte(item.ContentHtml)) -w.Write(topic_63) -w.Write([]byte(item.UserSlug)) -w.Write(topic_64) -w.Write([]byte(strconv.Itoa(item.CreatedBy))) -w.Write(topic_65) -w.Write([]byte(item.CreatedByName)) -w.Write(topic_66) -if tmpl_topic_vars.CurrentUser.Perms.LikeItem { -w.Write(topic_67) -w.Write([]byte(strconv.Itoa(item.ID))) -w.Write(topic_68) -if item.Liked { -w.Write(topic_69) } +w.Write(topic_63) +w.Write([]byte(item.ContentHtml)) +w.Write(topic_64) +w.Write([]byte(item.UserSlug)) +w.Write(topic_65) +w.Write([]byte(strconv.Itoa(item.CreatedBy))) +w.Write(topic_66) +w.Write([]byte(item.CreatedByName)) +w.Write(topic_67) +if tmpl_topic_vars.CurrentUser.Perms.LikeItem { +w.Write(topic_68) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_69) +if item.Liked { w.Write(topic_70) } -if tmpl_topic_vars.CurrentUser.Perms.EditReply { w.Write(topic_71) -w.Write([]byte(strconv.Itoa(item.ID))) +} +if tmpl_topic_vars.CurrentUser.Perms.EditReply { w.Write(topic_72) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_73) } if tmpl_topic_vars.CurrentUser.Perms.DeleteReply { -w.Write(topic_73) -w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_74) -} -w.Write(topic_75) w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_75) +} w.Write(topic_76) -w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) +w.Write([]byte(strconv.Itoa(item.ID))) w.Write(topic_77) -if item.LikeCount > 0 { +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) w.Write(topic_78) -w.Write([]byte(strconv.Itoa(item.LikeCount))) +if item.LikeCount > 0 { w.Write(topic_79) +w.Write([]byte(strconv.Itoa(item.LikeCount))) +w.Write(topic_80) } if item.Tag != "" { -w.Write(topic_80) -w.Write([]byte(item.Tag)) w.Write(topic_81) -} else { +w.Write([]byte(item.Tag)) w.Write(topic_82) -w.Write([]byte(strconv.Itoa(item.Level))) +} else { w.Write(topic_83) -} +w.Write([]byte(strconv.Itoa(item.Level))) w.Write(topic_84) } -} -} w.Write(topic_85) -if tmpl_topic_vars.CurrentUser.Perms.CreateReply { +} +} +} w.Write(topic_86) -w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +if tmpl_topic_vars.CurrentUser.Perms.CreateReply { w.Write(topic_87) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_88) } w.Write(footer_0) if tmpl_topic_vars.Header.Widgets.RightSidebar != "" { diff --git a/templates.go b/templates.go index 06f69543..c31e85db 100644 --- a/templates.go +++ b/templates.go @@ -985,6 +985,7 @@ func (c *CTemplateSet) compile_command(*parse.CommandNode) (out string) { return "" } +// TO-DO: Write unit tests for this func minify(data string) string { data = strings.Replace(data,"\t","",-1) data = strings.Replace(data,"\v","",-1) @@ -993,3 +994,40 @@ func minify(data string) string { data = strings.Replace(data," "," ",-1) return data } + +// TO-DO: Strip comments +// TO-DO: Handle CSS nested in