├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── bee.json ├── beeweb.go ├── conf ├── app.conf ├── compress.json ├── locale_en-US.ini ├── locale_ru-RU.ini └── locale_zh-CN.ini ├── models ├── http.go ├── models.go ├── press.go └── products.go ├── routers ├── blog.go ├── community.go ├── docs.go ├── donate.go ├── home.go ├── init.go ├── page.go ├── products.go ├── quickstart.go ├── router.go ├── samples.go └── video.go ├── static ├── font │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ └── fontawesome-webfont.woff └── img │ ├── alipay.png │ ├── arrow left.svg │ ├── arrow right.svg │ ├── avatar │ ├── 64f3f973dcfa1d34af6a6297f8bc393b_normal.jpeg │ ├── 654bd33f0c2a96261f38895e1f7e9ce8_normal.jpeg │ └── jemeshsu-04_normal.png │ ├── bee.gif │ ├── bee.png │ ├── bee_64.png │ ├── beego_logo.png │ ├── beego_logo2.png │ ├── beego_mdongorg.png │ ├── beego_purple.png │ ├── bg.jpg │ ├── brands │ ├── 17173.png │ ├── 360.png │ ├── ardanstudios.png │ ├── bmob.png │ ├── hwclouds.png │ ├── jd.png │ ├── letvcloud.png │ ├── lianjia.png │ ├── lianzong.png │ ├── meituan.png │ ├── oupeng.png │ ├── snda.png │ ├── taobao.png │ ├── tencent.png │ ├── tudou.png │ ├── weibo.png │ ├── weico.png │ ├── wepiao.png │ ├── youdao.png │ └── zalora.png │ ├── community │ ├── IRC.png │ ├── github.png │ ├── google-groups.png │ ├── stackoverflow.png │ └── twitter.png │ ├── favicon.png │ ├── footer-links.png │ ├── fork-us-on-github.png │ └── website-footer.svg ├── static_source ├── css │ ├── base.css │ ├── bootstrap-theme.css │ ├── bootstrap.css │ ├── font-awesome-ie7.min.css │ ├── font-awesome.min.css │ ├── main.css │ ├── markdown.css │ ├── prettify.css │ └── select2.css ├── index.html └── js │ ├── admin.js │ ├── bootstrap.js │ ├── editor.js │ ├── highlight.pack.js │ ├── html5shiv.js │ ├── imagesloaded.pkgd.min.js │ ├── jRespond.min.js │ ├── jStorage.js │ ├── jquery.clingify.min.js │ ├── jquery.extend.js │ ├── jquery.jpanelmenu.min.js │ ├── jquery.min.js │ ├── lib.min.js │ ├── main.js │ ├── masonry.pkgd.min.js │ ├── prettify.js │ └── respond.min.js └── views ├── about.html ├── base ├── base.html ├── disqus.html ├── footer.html ├── head.html └── navbar.html ├── blog.html ├── community.html ├── docs.html ├── donate.html ├── home.html ├── products.html ├── quickstart.html ├── samples_en.html ├── team.html ├── tweets.html └── video.html /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.exe~ 3 | website 4 | .DS_Store 5 | bee 6 | /docs 7 | /blog 8 | /products 9 | docTree.json 10 | blogTree.json 11 | productTree.json 12 | beeweb 13 | /log 14 | bale/ 15 | bale.go 16 | *.go~ 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang 2 | MAINTAINER astaxie xiemengjun@gmail.com 3 | 4 | RUN go get github.com/astaxie/beego 5 | 6 | RUN go get github.com/beego/beeweb 7 | 8 | WORKDIR /go/src/github.com/beego/beeweb 9 | 10 | RUN go build 11 | 12 | EXPOSE 8080 13 | 14 | CMD ["./beeweb"] 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Beego Web 2 | 3 | [![Requirement >= Go 1.2rc1](http://b.repl.ca/v1/Requirement-%3E%3D_Go%201.2rc1-blue.png)]() [![Requirement >= beego 0.9.9](http://b.repl.ca/v1/Requirement-%3E%3D_beego%200.9.9-blue.png)]() 4 | 5 | An open source project for official documentation website of beego app framework. 6 | 7 | ## Install site locally 8 | 9 | Beego Web is a `go get` able project: 10 | 11 | $ go get github.com/beego/beeweb 12 | 13 | Switch to project root path: 14 | 15 | $ cd $GOPATH/src/github.com/beego/beeweb 16 | 17 | Build and run with Go tools: 18 | 19 | $ go build 20 | $ ./beeweb 21 | 22 | Or build with bee tool: 23 | 24 | $ bee run 25 | 26 | Open your browser and visit [http://localhost:8090](http://localhost:8090). 27 | 28 | ## Build as your site 29 | 30 | This project can be easily transferred as your own documentation site, there are some tips that you may want to know: 31 | 32 | - In the file `conf/app.ini`: 33 | 34 | - `lang -> types`: languages that you want to support 35 | - `lang -> names`: user-friendly name of languages. 36 | - It's **NOT** necessary but if you want to you can use GitHub app keys as following format: 37 | 38 | [github] 39 | client_id=1862bcb2******f36c 40 | client_secret=308d71ab53ccd858416cfceaed52******53c5f 41 | 42 | - In the file `conf/docTree.json`: 43 | 44 | - This file saves the file tree(with file name and commit) of your project that is hosted in GitHub. About how to use documentation project please see [beedoc](http://github.com/beego/beedoc). Note that if you added new section to documentation list and you do not want to wait auto-refresh, simple delete this file and restart. 45 | - To change the documentation project URL, you need to change it in function `checkDocUpdates` in file `models/models.go`, as well as somewhere in `views`. -------------------------------------------------------------------------------- /bee.json: -------------------------------------------------------------------------------- 1 | { 2 | "go_install": true, 3 | "watch_ext": [ 4 | ".ini" 5 | ], 6 | "dir_structure":{ 7 | "controllers": "routers", 8 | "models": "", 9 | "others": [ 10 | ] 11 | }, 12 | "bale": { 13 | "import": "github.com/beego/beeweb/bale", 14 | "dirs": [ 15 | "conf", "views", "static" 16 | ], 17 | "ignore_ext": [ 18 | ".go", ".DS_Store" 19 | ] 20 | } 21 | } -------------------------------------------------------------------------------- /beeweb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | // An open source project for official documentation and blog website of beego app framework. 16 | package main 17 | 18 | import ( 19 | "os" 20 | 21 | "github.com/astaxie/beego" 22 | "github.com/beego/i18n" 23 | 24 | "github.com/beego/beeweb/models" 25 | "github.com/beego/beeweb/routers" 26 | ) 27 | 28 | const ( 29 | APP_VER = "1.0.0" 30 | ) 31 | 32 | // We have to call a initialize function manully 33 | // because we use `bee bale` to pack static resources 34 | // and we cannot make sure that which init() execute first. 35 | func initialize() { 36 | models.InitModels() 37 | 38 | routers.IsPro = beego.BConfig.RunMode == "prod" 39 | if routers.IsPro { 40 | beego.SetLevel(beego.LevelInformational) 41 | os.Mkdir("./log", os.ModePerm) 42 | beego.BeeLogger.SetLogger("file", `{"filename": "log/log"}`) 43 | } 44 | 45 | routers.InitApp() 46 | } 47 | 48 | func main() { 49 | 50 | initialize() 51 | 52 | beego.Info(beego.BConfig.AppName, APP_VER) 53 | 54 | beego.InsertFilter("/docs/images/:all", beego.BeforeRouter, routers.DocsStatic) 55 | 56 | if !routers.IsPro { 57 | beego.SetStaticPath("/static_source", "static_source") 58 | beego.BConfig.WebConfig.DirectoryIndex = true 59 | } 60 | 61 | beego.SetStaticPath("/products/images", "products/images/") 62 | 63 | // Register routers. 64 | beego.Router("/", &routers.HomeRouter{}) 65 | beego.Router("/community", &routers.CommunityRouter{}) 66 | beego.Router("/quickstart", &routers.QuickStartRouter{}) 67 | beego.Router("/video", &routers.VideoRouter{}) 68 | beego.Router("/products", &routers.ProductsRouter{}) 69 | beego.Router("/team", &routers.PageRouter{}) 70 | beego.Router("/about", &routers.AboutRouter{}) 71 | beego.Router("/donate", &routers.DonateRouter{}) 72 | beego.Router("/docs/", &routers.DocsRouter{}) 73 | beego.Router("/docs/*", &routers.DocsRouter{}) 74 | beego.Router("/blog", &routers.BlogRouter{}) 75 | beego.Router("/blog/*", &routers.BlogRouter{}) 76 | 77 | // Register template functions. 78 | beego.AddFuncMap("i18n", i18n.Tr) 79 | 80 | beego.Run() 81 | } 82 | -------------------------------------------------------------------------------- /conf/app.conf: -------------------------------------------------------------------------------- 1 | [beego] 2 | app_name=Beego Web 3 | run_mode=dev 4 | http_port_dev=8090 5 | http_port_pro=8090 6 | 7 | [lang] 8 | types=en-US|zh-CN|ru-RU 9 | names=English|简体中文|Russian 10 | 11 | [github] 12 | client_id= 13 | client_secret= 14 | 15 | [app] 16 | 17 | -------------------------------------------------------------------------------- /conf/compress.json: -------------------------------------------------------------------------------- 1 | { 2 | "Js": { 3 | "SrcPath": "static_source/js", 4 | "DistPath": "static/js", 5 | "SrcURL": "static_source/js", 6 | "DistURL": "static/js", 7 | "Groups": { 8 | "lib": { 9 | "DistFile": "lib.min.js", 10 | "SourceFiles": [ 11 | "jquery.min.js", 12 | "jquery.extend.js", 13 | "bootstrap.js", 14 | "lib.min.js", 15 | "prettify.js", 16 | "jStorage.js", 17 | "jquery.jpanelmenu.min.js", 18 | "jRespond.min.js", 19 | "jquery.clingify.min.js", 20 | "imagesloaded.pkgd.min.js", 21 | "masonry.pkgd.min.js" 22 | ], 23 | "SkipFiles": [ 24 | "jquery.min.js", 25 | "lib.min.js", 26 | "prettify.js", 27 | "jquery.jpanelmenu.min.js", 28 | "jRespond.min.js", 29 | "jquery.clingify.min.js", 30 | "imagesloaded.pkgd.min.js", 31 | "masonry.pkgd.min.js" 32 | ] 33 | }, 34 | "app": { 35 | "DistFile": "app.min.js", 36 | "SourceFiles": [ 37 | "main.js" 38 | ] 39 | }, 40 | "ie9": { 41 | "DistFile": "ie9.min.js", 42 | "SourceFiles": [ 43 | "html5shiv.js", 44 | "respond.min.js" 45 | ] 46 | } 47 | } 48 | }, 49 | "Css": { 50 | "SrcPath": "static_source/css", 51 | "DistPath": "static/css", 52 | "SrcURL": "static_source/css", 53 | "DistURL": "static/css", 54 | "Groups": { 55 | "lib": { 56 | "DistFile": "lib.min.css", 57 | "SourceFiles": [ 58 | "bootstrap.css", 59 | "bootstrap-theme.css", 60 | "font-awesome.min.css", 61 | "prettify.css", 62 | "select2.css" 63 | ], 64 | "SkipFiles": [ 65 | "font-awesome.min.css", 66 | "select2.css" 67 | ] 68 | }, 69 | "ie7": { 70 | "Name": "ie7", 71 | "DistFile": "ie7.min.css", 72 | "SourceFiles": [ 73 | "font-awesome-ie7.min.css" 74 | ], 75 | "SkipFiles": [ 76 | "font-awesome-ie7.min.css" 77 | ] 78 | }, 79 | "app": { 80 | "Name": "app", 81 | "DistFile": "app.min.css", 82 | "SourceFiles": [ 83 | "base.css", 84 | "markdown.css", 85 | "main.css" 86 | ] 87 | } 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /conf/locale_en-US.ini: -------------------------------------------------------------------------------- 1 | enable_js_prompt = Please enable JavaScript in your browser! 2 | app_intro = simple & powerful Go app framework 3 | app_fullintro = Beego is an open-source framework to quickly build and develop Go applications. It was inspired by tornado and sinatra, but we give you true Go experiences when you are coding, not translating! RESTful, MVC, session, cache, intelligent routing, thread-safe map, hot upgrade, and all the things you're going to fall in love with. 4 | 5 | homepage = Homepage 6 | home = Home 7 | about = About 8 | team = Team 9 | community = Community 10 | getting started = Getting started 11 | docs = Documentation 12 | video = Video 13 | blog = Blog 14 | copyright = Copyright 15 | products_use_beego = Which products use beego 16 | products = Products 17 | submit_your_product = Submit your product in GitHub 18 | 19 | zh-CN = 简体中文 20 | en-US = English 21 | ru-RU = Russian 22 | 23 | version = stable v1.10.0 24 | 25 | googlesearch = 014389342508982455625:2tomkdt5uo4 26 | 27 | learn more = Learn more 28 | get started = Get started! 29 | latest news = Latest news: 30 | tweets title = What people are saying about us: 31 | site_issue = Website issues please submit on Github. 32 | 33 | app_license = Under the apache 2.0 licence. Logo designed by Tengfei. 34 | lang option = Language: 35 | current_lang = Language: 36 | 37 | improve doc on github = Improve this page on GitHub 38 | add use case = Add your use case 39 | 40 | [home] 41 | 42 | beego_desc = An open source framework to build and develop your applications in the Go way 43 | quick_start = Quick Start 44 | further_reading = Further Reading 45 | features = Features 46 | who_are_use = Our well-known customers 47 | -------------------------------------------------------------------------------- /conf/locale_ru-RU.ini: -------------------------------------------------------------------------------- 1 | enable_js_prompt = Пожалуйста, включите JavaScript в вашем браузере! 2 | app_intro = простой и мощный фреймворк для веб-приложений на языке Go 3 | app_fullintro = Beego свободный фреймворк для быстрой разработки Go приложений. Вдохновлен такими инструментами как tornado и sinatra, но мы даем вам настойщее Go кодирование, не транслирование! RESTful, MVC, сессии, кеш, умный роутинг, потого-безопасный мапинг, горячий апгрейд, и другие вещи в которые вы влюбитесь. 4 | 5 | homepage = Главная 6 | home = Главная 7 | about = О проекте 8 | team = Команда 9 | community = Сообщество 10 | getting started = Быстрый старт 11 | docs = Документация 12 | video = Видео 13 | blog = Блог 14 | copyright = Copyright 15 | products_use_beego = Продукты, использующие beego 16 | products = Продукты 17 | submit_your_product = Добавьте Ваш проект на GitHub 18 | 19 | zh-CN = 简体中文 20 | en-US = English 21 | ru-RU = Русский 22 | 23 | version = стабильная v1.10.0 24 | 25 | googlesearch = 014389342508982455625:2tomkdt5uo4 26 | 27 | learn more = Подробнее 28 | get started = Быстрый старт 29 | latest news = Последние новости: 30 | tweets title = Что люди говорят о нас: 31 | site_issue = Если Вы нашли ошибку, пожалуйста, пишите на GitHub. 32 | 33 | app_license = Под лицензией apache 2.0. Дизайн логотипа Tengfei. 34 | lang option = Язык: 35 | current_lang = Язык: 36 | 37 | improve doc on github = Улучшите эту страницу на GitHub 38 | add use case = Добавить ваш вариант использование 39 | 40 | [home] 41 | 42 | beego_desc = Свободно распостаняемый фреймворк для разработки и сборки ваших приложений на языке Go 43 | quick_start = Быстрый старт 44 | further_reading = Читайте далее 45 | features = Возможности 46 | who_are_use = Наши клиенты 47 | -------------------------------------------------------------------------------- /conf/locale_zh-CN.ini: -------------------------------------------------------------------------------- 1 | enable_js_prompt = 请启用您浏览器的 JavaScript 选项! 2 | app_intro = 简约 & 强大并存的 Go 应用框架 3 | app_fullintro = beego 是一个用于帮助您快速构建并开发 Go Web 应用程序的开源框架。她的灵感来自于 tornado 和 sinatra,但我们提供给您的是真实的 Go 编码体验,而非语言之间的程序翻译!RESTful、MVC 模式、Session、缓存、线程安全的 Map、热升级以及您将爱不释手的一切特性。 4 | 5 | homepage = 首页 6 | home = 首页 7 | about = 关于 8 | team = 团队 9 | community = 开发者社区 10 | getting started = 快速入门 11 | docs = 开发文档 12 | video = 视频教程 13 | blog = 官方博客 14 | copyright = 版权所有 15 | products_use_beego = 使用 Beego 的产品 16 | products = 产品案例 17 | submit_your_product = 通过 GitHub 提交案例 18 | 19 | zh-CN = 简体中文 20 | en-US = English 21 | ru-RU = Russian 22 | 23 | version = v2.0.0 24 | googlesearch = 014389342508982455625:6zv6mwcpcck 25 | 26 | learn more = 了解更多 27 | get started = 立即开始 28 | latest news = 最近新闻: 29 | tweets title = 开发者们对 beego 的评价: 30 | site_issue = 网站问题请在 Github 上提交。 31 | 32 | app_license = 授权许可遵循 apache 2.0 licence Logo由 Tengfei 设计 33 | lang option = 语言选项: 34 | current_lang = 当前语言: 35 | 36 | improve doc on github = 到 GitHub 上改进本页面 37 | add use case = 增加您的开发案例 38 | 39 | Documentation = 开发者文档 40 | 41 | [home] 42 | 43 | beego_desc = 最简单易用的企业级Go应用开发框架 44 | quick_start = 快速开始 45 | further_reading = 延伸阅读 46 | features = 框架特性 47 | who_are_use = 知名 beego 用户 48 | -------------------------------------------------------------------------------- /models/http.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Gary Burd 2 | // Copyright 2013 Beego Web authors 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | // not use this file except in compliance with the License. You may obtain 6 | // a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | // License for the specific language governing permissions and limitations 14 | // under the License. 15 | 16 | package models 17 | 18 | import ( 19 | "encoding/json" 20 | "errors" 21 | "flag" 22 | "io/ioutil" 23 | "net" 24 | "net/http" 25 | "time" 26 | 27 | "github.com/astaxie/beego" 28 | ) 29 | 30 | var userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1541.0 Safari/537.36" 31 | 32 | var ( 33 | dialTimeout = flag.Duration("dial_timeout", 10*time.Second, "Timeout for dialing an HTTP connection.") 34 | requestTimeout = flag.Duration("request_timeout", 20*time.Second, "Time out for roundtripping an HTTP request.") 35 | ) 36 | 37 | func timeoutDial(network, addr string) (net.Conn, error) { 38 | return net.DialTimeout(network, addr, *dialTimeout) 39 | } 40 | 41 | type transport struct { 42 | t http.Transport 43 | } 44 | 45 | func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { 46 | timer := time.AfterFunc(*requestTimeout, func() { 47 | t.t.CancelRequest(req) 48 | beego.Warn("Canceled request for %s", req.URL) 49 | }) 50 | defer timer.Stop() 51 | resp, err := t.t.RoundTrip(req) 52 | return resp, err 53 | } 54 | 55 | var ( 56 | httpTransport = &transport{t: http.Transport{Dial: timeoutDial, ResponseHeaderTimeout: *requestTimeout / 2}} 57 | httpClient = &http.Client{Transport: httpTransport} 58 | ) 59 | 60 | func getHttpJson(url string, v interface{}) error { 61 | req, err := http.NewRequest("GET", url, nil) 62 | if err != nil { 63 | return err 64 | } 65 | req.Header.Set("User-Agent", userAgent) 66 | 67 | resp, err := httpClient.Do(req) 68 | if err != nil { 69 | return err 70 | } 71 | defer resp.Body.Close() 72 | if resp.StatusCode == 200 { 73 | err = json.NewDecoder(resp.Body).Decode(v) 74 | if _, ok := err.(*json.SyntaxError); ok { 75 | return errors.New("JSON syntax error at " + url) 76 | } 77 | return nil 78 | } 79 | return errors.New("can't get infomation") 80 | } 81 | 82 | func getFiles(files []*rawFile) error { 83 | ch := make(chan error, len(files)) 84 | for i := range files { 85 | go func(i int) { 86 | req, err := http.NewRequest("GET", files[i].rawURL, nil) 87 | if err != nil { 88 | ch <- err 89 | return 90 | } 91 | req.Header.Set("User-Agent", userAgent) 92 | resp, err := httpClient.Do(req) 93 | if err != nil { 94 | ch <- err 95 | return 96 | } 97 | defer resp.Body.Close() 98 | if resp.StatusCode == 200 { 99 | p, err := ioutil.ReadAll(resp.Body) 100 | if err != nil { 101 | ch <- err 102 | return 103 | } 104 | files[i].data = p 105 | } 106 | ch <- nil 107 | }(i) 108 | } 109 | for _ = range files { 110 | if err := <-ch; err != nil { 111 | return err 112 | } 113 | } 114 | return nil 115 | } 116 | -------------------------------------------------------------------------------- /models/models.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | // Package models is for loading and updating documentation files. 16 | package models 17 | 18 | import ( 19 | "encoding/json" 20 | "errors" 21 | "os" 22 | "path" 23 | "strconv" 24 | "strings" 25 | "sync" 26 | "time" 27 | 28 | "github.com/astaxie/beego" 29 | "github.com/astaxie/beego/toolbox" 30 | "github.com/astaxie/beego/utils" 31 | "github.com/slene/blackfriday" 32 | ) 33 | 34 | var docs = make(map[string]*DocRoot) 35 | 36 | type oldDocNode struct { 37 | Sha string 38 | Path string 39 | Type string 40 | } 41 | 42 | // docTree descriables a documentation file structure tree. 43 | var docTree struct { 44 | Tree []oldDocNode 45 | } 46 | 47 | var blogTree struct { 48 | Tree []oldDocNode 49 | } 50 | 51 | var productTree struct { 52 | Tree []oldDocNode 53 | } 54 | 55 | type docFile struct { 56 | Title string 57 | Data []byte 58 | } 59 | 60 | var ( 61 | docLock *sync.RWMutex 62 | blogLock *sync.RWMutex 63 | docMap map[string]*docFile 64 | blogMap map[string]*docFile 65 | ) 66 | 67 | var githubCred string 68 | 69 | func setGithubCredentials(id, secret string) { 70 | githubCred = "client_id=" + id + "&client_secret=" + secret 71 | } 72 | 73 | func GetDocByLocale(lang string) *DocRoot { 74 | return docs[lang] 75 | } 76 | 77 | func InitModels() { 78 | 79 | setGithubCredentials(beego.AppConfig.String("github::client_id"), 80 | beego.AppConfig.String("github::client_secret")) 81 | 82 | docLock = new(sync.RWMutex) 83 | blogLock = new(sync.RWMutex) 84 | 85 | parseDocs() 86 | initMaps() 87 | initProuctCase() 88 | 89 | updateTask := toolbox.NewTask("check file update", "0 */5 * * * *", checkFileUpdates) 90 | 91 | if needCheckUpdate() { 92 | if err := updateTask.Run(); err != nil { 93 | beego.Error(err) 94 | } 95 | 96 | beego.AppConfig.Set("app::update_check_time", strconv.Itoa(int(time.Now().Unix()))) 97 | } 98 | 99 | // ATTENTION: you'd better comment following code when developing. 100 | toolbox.AddTask("check file update", updateTask) 101 | toolbox.StartTask() 102 | } 103 | 104 | func parseDocs() { 105 | root, err := ParseDocs("docs/zh-CN") 106 | if err != nil { 107 | beego.Error(err) 108 | } 109 | 110 | if root != nil { 111 | docs["zh-CN"] = root 112 | } 113 | 114 | root, err = ParseDocs("docs/en-US") 115 | if err != nil { 116 | beego.Error(err) 117 | } 118 | 119 | if root != nil { 120 | docs["en-US"] = root 121 | } 122 | 123 | root, err = ParseDocs("docs/ru-RU") 124 | if err != nil { 125 | beego.Error(err) 126 | } 127 | 128 | if root != nil { 129 | docs["ru-RU"] = root 130 | } 131 | } 132 | 133 | func needCheckUpdate() bool { 134 | // Does not have record for check update. 135 | stamp, err := beego.AppConfig.Int64("app::update_check_time") 136 | if err != nil { 137 | return true 138 | } 139 | 140 | if !utils.FileExists("conf/docTree.json") || !utils.FileExists("conf/blogTree.json") || 141 | !utils.FileExists("conf/productTree.json") { 142 | return true 143 | } 144 | 145 | return time.Unix(stamp, 0).Add(5 * time.Minute).Before(time.Now()) 146 | } 147 | 148 | func initDocMap() { 149 | // Documentation names. 150 | docNames := make([]string, 0, 20) 151 | docNames = append(docNames, strings.Split( 152 | beego.AppConfig.String("app::doc_names"), "|")...) 153 | 154 | isConfExist := utils.FileExists("conf/docTree.json") 155 | if isConfExist { 156 | f, err := os.Open("conf/docTree.json") 157 | if err != nil { 158 | beego.Error("models.initDocMap -> load data:", err.Error()) 159 | return 160 | } 161 | defer f.Close() 162 | 163 | d := json.NewDecoder(f) 164 | if err = d.Decode(&docTree); err != nil { 165 | beego.Error("models.initDocMap -> decode data:", err.Error()) 166 | return 167 | } 168 | } else { 169 | // Generate 'docTree'. 170 | for _, v := range docNames { 171 | docTree.Tree = append(docTree.Tree, oldDocNode{Path: v}) 172 | } 173 | } 174 | 175 | docLock.Lock() 176 | defer docLock.Unlock() 177 | 178 | docMap = make(map[string]*docFile) 179 | langs := strings.Split(beego.AppConfig.String("lang::types"), "|") 180 | 181 | os.Mkdir("docs", os.ModePerm) 182 | for _, l := range langs { 183 | os.Mkdir("docs/"+l, os.ModePerm) 184 | for _, v := range docTree.Tree { 185 | var fullName string 186 | if isConfExist { 187 | fullName = v.Path 188 | } else { 189 | fullName = l + "/" + v.Path 190 | } 191 | 192 | docMap[fullName] = getFile("docs/" + fullName) 193 | } 194 | } 195 | } 196 | 197 | func initBlogMap() { 198 | os.Mkdir("blog", os.ModePerm) 199 | langs := strings.Split(beego.AppConfig.String("lang::types"), "|") 200 | for _, l := range langs { 201 | os.Mkdir("blog/"+l, os.ModePerm) 202 | } 203 | 204 | if !utils.FileExists("conf/blogTree.json") { 205 | beego.Error("models.initBlogMap -> conf/blogTree.json does not exist") 206 | return 207 | } 208 | 209 | f, err := os.Open("conf/blogTree.json") 210 | if err != nil { 211 | beego.Error("models.initBlogMap -> load data:", err.Error()) 212 | return 213 | } 214 | defer f.Close() 215 | 216 | d := json.NewDecoder(f) 217 | err = d.Decode(&blogTree) 218 | if err != nil { 219 | beego.Error("models.initBlogMap -> decode data:", err.Error()) 220 | return 221 | } 222 | 223 | blogLock.Lock() 224 | defer blogLock.Unlock() 225 | 226 | blogMap = make(map[string]*docFile) 227 | for _, v := range blogTree.Tree { 228 | blogMap[v.Path] = getFile("blog/" + v.Path) 229 | } 230 | } 231 | 232 | func initMaps() { 233 | initDocMap() 234 | initBlogMap() 235 | initProuctCase() 236 | } 237 | 238 | // loadFile returns []byte of file data by given path. 239 | func loadFile(filePath string) ([]byte, error) { 240 | f, err := os.Open(filePath) 241 | if err != nil { 242 | return []byte(""), errors.New("Fail to open file: " + err.Error()) 243 | } 244 | 245 | fi, err := f.Stat() 246 | if err != nil { 247 | return []byte(""), errors.New("Fail to get file information: " + err.Error()) 248 | } 249 | 250 | d := make([]byte, fi.Size()) 251 | f.Read(d) 252 | return d, nil 253 | } 254 | 255 | func markdown(raw []byte) []byte { 256 | htmlFlags := 0 257 | htmlFlags |= blackfriday.HTML_USE_XHTML 258 | htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS 259 | htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS 260 | htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES 261 | htmlFlags |= blackfriday.HTML_GITHUB_BLOCKCODE 262 | htmlFlags |= blackfriday.HTML_OMIT_CONTENTS 263 | htmlFlags |= blackfriday.HTML_COMPLETE_PAGE 264 | renderer := blackfriday.HtmlRenderer(htmlFlags, "", "") 265 | 266 | // set up the parser 267 | extensions := 0 268 | extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS 269 | extensions |= blackfriday.EXTENSION_TABLES 270 | extensions |= blackfriday.EXTENSION_FENCED_CODE 271 | extensions |= blackfriday.EXTENSION_AUTOLINK 272 | extensions |= blackfriday.EXTENSION_STRIKETHROUGH 273 | extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK 274 | extensions |= blackfriday.EXTENSION_SPACE_HEADERS 275 | extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK 276 | 277 | body := blackfriday.Markdown(raw, renderer, extensions) 278 | return body 279 | } 280 | 281 | func getFile(filePath string) *docFile { 282 | if strings.Contains(filePath, "images") { 283 | return nil 284 | } 285 | 286 | df := &docFile{} 287 | p, err := loadFile(filePath + ".md") 288 | if err != nil { 289 | beego.Error("models.getFile -> ", err) 290 | return nil 291 | } 292 | 293 | // Parse and render. 294 | s := string(p) 295 | i := strings.Index(s, "\n") 296 | if i > -1 { 297 | // Has title. 298 | df.Title = strings.TrimSpace( 299 | strings.Replace(s[:i+1], "#", "", -1)) 300 | if len(s) >= i+2 { 301 | df.Data = []byte(strings.TrimSpace(s[i+2:])) 302 | } 303 | } else { 304 | df.Data = p 305 | } 306 | 307 | df.Data = markdown(df.Data) 308 | return df 309 | } 310 | 311 | // GetDoc returns 'docFile' by given name and language version. 312 | func GetDoc(fullName, lang string) *docFile { 313 | filePath := "docs/" + lang + "/" + fullName 314 | 315 | if beego.BConfig.RunMode == "dev" { 316 | return getFile(filePath) 317 | } 318 | 319 | docLock.RLock() 320 | defer docLock.RUnlock() 321 | return docMap[lang+"/"+fullName] 322 | } 323 | 324 | // GetBlog returns 'docFile' by given name and language version. 325 | func GetBlog(fullName, lang string) *docFile { 326 | filePath := "blog/" + lang + "/" + fullName 327 | 328 | if beego.BConfig.RunMode == "dev" { 329 | return getFile(filePath) 330 | } 331 | 332 | blogLock.RLock() 333 | defer blogLock.RUnlock() 334 | return blogMap[lang+"/"+fullName] 335 | } 336 | 337 | var checkTicker *time.Ticker 338 | 339 | func checkTickerTimer(checkChan <-chan time.Time) { 340 | for { 341 | <-checkChan 342 | checkFileUpdates() 343 | } 344 | } 345 | 346 | type rawFile struct { 347 | name string 348 | rawURL string 349 | data []byte 350 | } 351 | 352 | func (rf *rawFile) Name() string { 353 | return rf.name 354 | } 355 | 356 | func (rf *rawFile) RawUrl() string { 357 | return rf.rawURL 358 | } 359 | 360 | func (rf *rawFile) Data() []byte { 361 | return rf.data 362 | } 363 | 364 | func (rf *rawFile) SetData(p []byte) { 365 | rf.data = p 366 | } 367 | 368 | func checkFileUpdates() error { 369 | beego.Trace("Checking file updates") 370 | 371 | type tree struct { 372 | ApiUrl, RawUrl, TreeName, Prefix string 373 | } 374 | 375 | var trees = []*tree{ 376 | { 377 | ApiUrl: "https://api.github.com/repos/beego/beedoc/git/trees/master?recursive=1&" + githubCred, 378 | RawUrl: "https://raw.github.com/beego/beedoc/master/", 379 | TreeName: "conf/docTree.json", 380 | Prefix: "docs/", 381 | }, 382 | { 383 | ApiUrl: "https://api.github.com/repos/beego/beeblog/git/trees/master?recursive=1&" + githubCred, 384 | RawUrl: "https://raw.github.com/beego/beeblog/master/", 385 | TreeName: "conf/blogTree.json", 386 | Prefix: "blog/", 387 | }, 388 | { 389 | ApiUrl: "https://api.github.com/repos/beego/products/git/trees/master?recursive=1&" + githubCred, 390 | RawUrl: "https://raw.github.com/beego/products/master/", 391 | TreeName: "conf/productTree.json", 392 | Prefix: "products/", 393 | }, 394 | } 395 | 396 | for _, tree := range trees { 397 | var tmpTree struct { 398 | Tree []*oldDocNode 399 | } 400 | 401 | err := getHttpJson(tree.ApiUrl, &tmpTree) 402 | if err != nil { 403 | return errors.New("models.checkFileUpdates -> get trees: " + err.Error()) 404 | } 405 | 406 | var saveTree struct { 407 | Tree []*oldDocNode 408 | } 409 | saveTree.Tree = make([]*oldDocNode, 0, len(tmpTree.Tree)) 410 | 411 | // Compare SHA. 412 | files := make([]*rawFile, 0, len(tmpTree.Tree)) 413 | for _, node := range tmpTree.Tree { 414 | // Skip non-md files and "README.md". 415 | if node.Type != "blob" || (!strings.HasSuffix(node.Path, ".md") && 416 | !strings.Contains(node.Path, "images") && 417 | !strings.HasSuffix(node.Path, ".json")) || 418 | strings.HasPrefix(strings.ToLower(node.Path), "readme") { 419 | continue 420 | } 421 | 422 | name := strings.TrimSuffix(node.Path, ".md") 423 | 424 | if checkSHA(name, node.Sha, tree.Prefix) { 425 | beego.Info("Need to update:", name) 426 | files = append(files, &rawFile{ 427 | name: name, 428 | rawURL: tree.RawUrl + node.Path, 429 | }) 430 | } 431 | 432 | saveTree.Tree = append(saveTree.Tree, &oldDocNode{ 433 | Path: name, 434 | Sha: node.Sha, 435 | }) 436 | // For save purpose, reset name. 437 | node.Path = name 438 | } 439 | 440 | // Fetch files. 441 | if err := getFiles(files); err != nil { 442 | return errors.New("models.checkFileUpdates -> fetch files: " + err.Error()) 443 | } 444 | 445 | // Update data. 446 | for _, f := range files { 447 | os.MkdirAll(path.Join(tree.Prefix, path.Dir(f.name)), os.ModePerm) 448 | suf := ".md" 449 | if strings.Contains(f.name, "images") || 450 | strings.HasSuffix(f.name, ".json") { 451 | suf = "" 452 | } 453 | fw, err := os.Create(tree.Prefix + f.name + suf) 454 | if err != nil { 455 | beego.Error("models.checkFileUpdates -> open file:", err.Error()) 456 | continue 457 | } 458 | 459 | _, err = fw.Write(f.data) 460 | fw.Close() 461 | if err != nil { 462 | beego.Error("models.checkFileUpdates -> write data:", err.Error()) 463 | continue 464 | } 465 | } 466 | 467 | // Save documentation information. 468 | f, err := os.Create(tree.TreeName) 469 | if err != nil { 470 | return errors.New("models.checkFileUpdates -> save data: " + err.Error()) 471 | } 472 | 473 | e := json.NewEncoder(f) 474 | err = e.Encode(&saveTree) 475 | if err != nil { 476 | return errors.New("models.checkFileUpdates -> encode data: " + err.Error()) 477 | } 478 | f.Close() 479 | } 480 | 481 | beego.Trace("Finish check file updates") 482 | parseDocs() 483 | initMaps() 484 | return nil 485 | } 486 | 487 | // checkSHA returns true if the documentation file need to update. 488 | func checkSHA(name, sha, prefix string) bool { 489 | var tree struct { 490 | Tree []oldDocNode 491 | } 492 | 493 | switch prefix { 494 | case "docs/": 495 | tree = docTree 496 | case "blog/": 497 | tree = blogTree 498 | default: 499 | tree = productTree 500 | } 501 | 502 | for _, v := range tree.Tree { 503 | if v.Path == name { 504 | // Found. 505 | if v.Sha != sha { 506 | // Need to update. 507 | return true 508 | } 509 | return false 510 | } 511 | } 512 | // Not found. 513 | return true 514 | } 515 | -------------------------------------------------------------------------------- /models/press.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package models 16 | 17 | import ( 18 | "bufio" 19 | "bytes" 20 | "fmt" 21 | "io" 22 | "io/ioutil" 23 | "os" 24 | "path/filepath" 25 | "sort" 26 | "strconv" 27 | "strings" 28 | "time" 29 | 30 | "github.com/astaxie/beego" 31 | ) 32 | 33 | type DocList []*DocNode 34 | 35 | func (s DocList) Len() int { return len(s) } 36 | func (s DocList) Swap(i, j int) { s[i], s[j] = s[j], s[i] } 37 | func (s DocList) Less(i, j int) bool { return s[i].Sort < s[j].Sort } 38 | 39 | type DocNode struct { 40 | root bool 41 | IsDir bool 42 | Path string 43 | RelPath string 44 | FileRelPath string 45 | FilePath string 46 | Date time.Time 47 | Name string 48 | Sort int 49 | Link string 50 | Docs DocList 51 | dirs map[string]*DocNode 52 | Root *DocRoot 53 | Parent *DocNode 54 | } 55 | 56 | func (d *DocNode) SortDocs() { 57 | sort.Sort(d.Docs) 58 | } 59 | 60 | func (d *DocNode) HasContent() bool { 61 | return len(d.FilePath) > 0 62 | } 63 | 64 | func (d *DocNode) GetContent() string { 65 | if !d.HasContent() { 66 | return "" 67 | } 68 | 69 | body, err := ioutil.ReadFile(d.FilePath) 70 | if err != nil { 71 | return "" 72 | } 73 | 74 | if i := bytes.Index(body, []byte("---")); i != -1 { 75 | body = body[i+3:] 76 | if i = bytes.Index(body, []byte("---")); i != -1 { 77 | body = body[i+3:] 78 | i = 0 79 | m := 0 80 | mFor: 81 | for { 82 | if len(body) > 0 { 83 | if body[0] == ' ' || body[0] == '\n' { 84 | if body[0] == '\n' { 85 | m += 1 86 | } 87 | if m == 2 { 88 | break mFor 89 | } 90 | } else { 91 | break mFor 92 | } 93 | body = body[1:] 94 | } else { 95 | break mFor 96 | } 97 | } 98 | 99 | return string(markdown(body)) 100 | } 101 | } 102 | 103 | return "" 104 | } 105 | 106 | type DocRoot struct { 107 | Wd string 108 | Path string 109 | Doc *DocNode 110 | links map[string]*DocNode 111 | } 112 | 113 | func (d *DocRoot) GetNodeByLink(link string) (*DocNode, bool) { 114 | n, ok := d.links[link] 115 | return n, ok 116 | } 117 | 118 | func (d *DocRoot) walkParse() error { 119 | var err error 120 | if d.Path, err = filepath.Abs(d.Path); err != nil { 121 | return err 122 | } 123 | 124 | defer func() { 125 | if err == nil { 126 | d.sortAll(d.Doc) 127 | } 128 | }() 129 | 130 | err = filepath.Walk(d.Path, d.walk) 131 | return err 132 | } 133 | 134 | func (d *DocRoot) sortAll(node *DocNode) { 135 | if node != nil { 136 | for _, n := range node.Docs { 137 | if n.IsDir { 138 | d.sortAll(n) 139 | } 140 | } 141 | node.SortDocs() 142 | } 143 | } 144 | 145 | func (d *DocRoot) makeDirNode(path string) error { 146 | relPath, _ := filepath.Rel(d.Path, path) 147 | 148 | var docDir *DocNode 149 | 150 | if d.Doc == nil { 151 | d.Doc = new(DocNode) 152 | d.Doc.dirs = make(map[string]*DocNode) 153 | docDir = d.Doc 154 | 155 | } else { 156 | list := strings.Split(relPath, string(filepath.Separator)) 157 | node := d.Doc 158 | for _, p := range list { 159 | if n, ok := node.dirs[p]; ok { 160 | node = n 161 | } else { 162 | n = new(DocNode) 163 | n.dirs = make(map[string]*DocNode) 164 | n.Parent = node 165 | node.Docs = append(node.Docs, n) 166 | node.dirs[p] = n 167 | node = n 168 | } 169 | } 170 | 171 | docDir = node 172 | } 173 | 174 | docDir.Root = d 175 | docDir.Path = path 176 | docDir.RelPath = relPath 177 | docDir.IsDir = true 178 | 179 | return nil 180 | } 181 | 182 | func (d *DocRoot) getDirNode(path string) *DocNode { 183 | node := d.Doc 184 | list := strings.Split(path, string(filepath.Separator)) 185 | for _, p := range list { 186 | if n, ok := node.dirs[p]; ok { 187 | node = n 188 | } 189 | } 190 | return node 191 | } 192 | 193 | func (d *DocRoot) makeFileNode(path string) error { 194 | file, err := os.Open(path) 195 | if err != nil { 196 | return err 197 | } 198 | defer file.Close() 199 | 200 | relPath, _ := filepath.Rel(d.Path, path) 201 | relPath = strings.Replace(relPath, "\\", "/", -1) 202 | 203 | docDir := d.getDirNode(filepath.Dir(relPath)) 204 | 205 | var bingo bool 206 | var doc *DocNode 207 | rd := bufio.NewReader(file) 208 | no := 0 209 | for { 210 | line, _, err := rd.ReadLine() 211 | if err == io.EOF { 212 | break 213 | } 214 | 215 | if no > 3 && !bingo { 216 | break 217 | } 218 | 219 | if no > 20 && bingo { 220 | return fmt.Errorf("document %s not contained ended tag `---`", path) 221 | } 222 | 223 | data := string(bytes.TrimSpace(line)) 224 | 225 | if len(data) == 3 && data == "---" { 226 | 227 | if bingo { 228 | if doc.root { 229 | if len(docDir.FilePath) > 0 { 230 | return fmt.Errorf("node %s has a document %s, can not replicate by %s", 231 | docDir.Path, docDir.FilePath, path) 232 | } 233 | 234 | docDir.Name = doc.Name 235 | docDir.Date = doc.Date 236 | docDir.Link = doc.Link 237 | docDir.Sort = doc.Sort 238 | 239 | mFor: 240 | for { 241 | l, _, er := rd.ReadLine() 242 | if er != nil { 243 | break mFor 244 | } 245 | if len(bytes.TrimSpace(l)) > 0 { 246 | docDir.FilePath = path 247 | break mFor 248 | } 249 | } 250 | 251 | if len(docDir.Link) == 0 { 252 | docDir.Link = docDir.RelPath + "/" 253 | } 254 | 255 | docDir.FileRelPath = relPath 256 | 257 | doc = docDir 258 | } else { 259 | doc.RelPath = relPath 260 | doc.FilePath = path 261 | if len(doc.Link) == 0 { 262 | doc.Link = doc.RelPath 263 | // doc.Link = strings.TrimSuffix(doc.RelPath, filepath.Ext(doc.RelPath)) 264 | } 265 | 266 | docDir.Docs = append(docDir.Docs, doc) 267 | } 268 | 269 | if dc, ok := d.links[doc.Link]; ok { 270 | return fmt.Errorf("document %s's link %s is already used by %s", path, doc.Link, dc.Path) 271 | } 272 | 273 | d.links[doc.Link] = doc 274 | 275 | break 276 | } 277 | 278 | doc = new(DocNode) 279 | doc.Path = path 280 | doc.Root = d 281 | doc.Parent = docDir 282 | 283 | bingo = true 284 | } 285 | 286 | if bingo { 287 | parts := strings.SplitN(data, ":", 2) 288 | if len(parts) == 2 { 289 | name := strings.TrimSpace(parts[0]) 290 | value := strings.TrimSpace(parts[1]) 291 | switch name { 292 | case "root": 293 | doc.root, _ = strconv.ParseBool(value) 294 | case "name": 295 | doc.Name = value 296 | case "date": 297 | doc.Date, err = beego.DateParse(value, "Y-m-d H:i") 298 | if err != nil { 299 | return err 300 | } 301 | case "link": 302 | doc.Link = value 303 | case "sort": 304 | n, _ := strconv.ParseInt(value, 10, 64) 305 | doc.Sort = int(n) 306 | } 307 | } 308 | } 309 | } 310 | 311 | return nil 312 | } 313 | 314 | func (d *DocRoot) walk(path string, info os.FileInfo, err error) error { 315 | if err != nil { 316 | return filepath.SkipDir 317 | } 318 | 319 | if !info.IsDir() && info.Size() == 0 { 320 | return nil 321 | } 322 | 323 | if info.IsDir() { 324 | if err := d.makeDirNode(path); err != nil { 325 | return err 326 | } 327 | } else { 328 | return d.makeFileNode(path) 329 | } 330 | 331 | return nil 332 | } 333 | 334 | func ParseDocs(path string) (*DocRoot, error) { 335 | root := new(DocRoot) 336 | root.Path = path 337 | root.links = make(map[string]*DocNode) 338 | 339 | if err := root.walkParse(); err == nil { 340 | return root, err 341 | } else { 342 | return nil, err 343 | } 344 | } 345 | -------------------------------------------------------------------------------- /models/products.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | import ( 4 | "encoding/json" 5 | "os" 6 | 7 | "github.com/astaxie/beego" 8 | "github.com/astaxie/beego/utils" 9 | ) 10 | 11 | type products struct { 12 | Projects []*Project 13 | } 14 | 15 | type Project struct { 16 | Name string 17 | Thumb string 18 | Desc string 19 | Url string 20 | Src string 21 | Submitter string 22 | Date string 23 | } 24 | 25 | var Products = new(products) 26 | 27 | func initProuctCase() { 28 | if !utils.FileExists("conf/productTree.json") { 29 | beego.Error("models.initBlogMap -> conf/productTree.json does not exist") 30 | return 31 | } 32 | 33 | f, err := os.Open("conf/productTree.json") 34 | if err != nil { 35 | beego.Error("models.initBlogMap -> load data:", err.Error()) 36 | return 37 | } 38 | defer f.Close() 39 | 40 | d := json.NewDecoder(f) 41 | err = d.Decode(&productTree) 42 | if err != nil { 43 | beego.Error("models.initBlogMap -> decode data:", err.Error()) 44 | return 45 | } 46 | 47 | fileName := "products/projects.json" 48 | 49 | aProducts := *Products 50 | 51 | var file *os.File 52 | 53 | if file, err = os.Open(fileName); err != nil { 54 | beego.Error("open %s, %s", fileName, err.Error()) 55 | return 56 | } 57 | 58 | d = json.NewDecoder(file) 59 | if err = d.Decode(&aProducts); err != nil { 60 | beego.Error("open %s, %s", fileName, err.Error()) 61 | return 62 | } 63 | 64 | for i, j := 0, len(aProducts.Projects)-1; i < j; i, j = i+1, j-1 { 65 | aProducts.Projects[i], aProducts.Projects[j] = aProducts.Projects[j], aProducts.Projects[i] 66 | } 67 | 68 | *Products = aProducts 69 | } 70 | -------------------------------------------------------------------------------- /routers/blog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package routers 16 | 17 | import ( 18 | "strings" 19 | 20 | "github.com/beego/beeweb/models" 21 | ) 22 | 23 | // BlogRouter serves about page. 24 | type BlogRouter struct { 25 | baseRouter 26 | } 27 | 28 | // Get implemented Get method for BlogRouter. 29 | func (this *BlogRouter) Get() { 30 | this.Data["IsBlog"] = true 31 | this.TplName = "blog.html" 32 | 33 | reqUrl := this.Ctx.Request.URL.String() 34 | fullName := reqUrl[strings.LastIndex(reqUrl, "/")+1:] 35 | if qm := strings.Index(fullName, "?"); qm > -1 { 36 | fullName = fullName[:qm] 37 | } 38 | 39 | df := models.GetBlog(fullName, this.Lang) 40 | if df == nil { 41 | this.Redirect("/blog", 302) 42 | return 43 | } 44 | 45 | this.Data["Title"] = df.Title 46 | this.Data["Data"] = string(df.Data) 47 | this.Data["IsHasMarkdown"] = true 48 | } 49 | -------------------------------------------------------------------------------- /routers/community.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package routers 16 | 17 | import ( 18 | "github.com/beego/beeweb/models" 19 | ) 20 | 21 | // CommunityRouter serves community page. 22 | type CommunityRouter struct { 23 | baseRouter 24 | } 25 | 26 | // Get implemented Get method for CommunityRouter. 27 | func (this *CommunityRouter) Get() { 28 | this.Data["IsCommunity"] = true 29 | this.TplName = "community.html" 30 | 31 | df := models.GetDoc("usecases", this.Lang) 32 | this.Data["Section"] = "usecases" 33 | this.Data["Data"] = string(df.Data) 34 | } 35 | -------------------------------------------------------------------------------- /routers/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package routers 16 | 17 | import ( 18 | "io" 19 | "os" 20 | 21 | "github.com/astaxie/beego" 22 | "github.com/astaxie/beego/context" 23 | "github.com/beego/i18n" 24 | 25 | "github.com/beego/beeweb/models" 26 | ) 27 | 28 | // DocsRouter serves about page. 29 | type DocsRouter struct { 30 | baseRouter 31 | } 32 | 33 | // Get implemented Get method for DocsRouter. 34 | func (this *DocsRouter) Get() { 35 | this.Data["IsDocs"] = true 36 | this.TplName = "docs.html" 37 | 38 | dRoot := models.GetDocByLocale(this.Lang) 39 | 40 | if dRoot == nil { 41 | this.Abort("404") 42 | return 43 | } 44 | 45 | link := this.GetString(":splat") 46 | beego.Info(link) 47 | var doc *models.DocNode 48 | if len(link) == 0 { 49 | if dRoot.Doc.HasContent() { 50 | doc = dRoot.Doc 51 | } else { 52 | this.Redirect("/docs/intro/", 302) 53 | return 54 | } 55 | } else { 56 | doc, _ = dRoot.GetNodeByLink(link) 57 | if doc == nil { 58 | doc, _ = dRoot.GetNodeByLink(link + "/") 59 | } 60 | } 61 | 62 | if doc == nil { 63 | this.Abort("404") 64 | return 65 | } 66 | 67 | this.Data["DocRoot"] = dRoot 68 | this.Data["Doc"] = doc 69 | this.Data["Title"] = doc.Name 70 | this.Data["Data"] = doc.GetContent() 71 | } 72 | 73 | func DocsStatic(ctx *context.Context) { 74 | if uri := ctx.Input.Param(":all"); len(uri) > 0 { 75 | lang := ctx.GetCookie("lang") 76 | if !i18n.IsExist(lang) { 77 | lang = "en-US" 78 | } 79 | 80 | f, err := os.Open("docs/" + lang + "/" + "images/" + uri) 81 | if err != nil { 82 | ctx.WriteString(err.Error()) 83 | return 84 | } 85 | defer f.Close() 86 | 87 | _, err = io.Copy(ctx.ResponseWriter, f) 88 | if err != nil { 89 | ctx.WriteString(err.Error()) 90 | return 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /routers/donate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package routers 16 | 17 | import ( 18 | "github.com/beego/beeweb/models" 19 | ) 20 | 21 | // DonateRouter serves Donate page. 22 | type DonateRouter struct { 23 | baseRouter 24 | } 25 | 26 | // Get implemented Get method for DonateRouter. 27 | func (this *DonateRouter) Get() { 28 | this.Data["IsDonate"] = true 29 | this.TplName = "donate.html" 30 | 31 | // Get language. 32 | df := models.GetDoc("donate", this.Lang) 33 | this.Data["Title"] = df.Title 34 | this.Data["Data"] = string(df.Data) 35 | this.Data["IsHasMarkdown"] = true 36 | } 37 | -------------------------------------------------------------------------------- /routers/home.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package routers 16 | 17 | // HomeRouter serves home page. 18 | type HomeRouter struct { 19 | baseRouter 20 | } 21 | 22 | // Get implemented Get method for HomeRouter. 23 | func (this *HomeRouter) Get() { 24 | this.Data["IsHome"] = true 25 | this.TplName = "home.html" 26 | } 27 | -------------------------------------------------------------------------------- /routers/init.go: -------------------------------------------------------------------------------- 1 | package routers 2 | 3 | import ( 4 | "errors" 5 | "path/filepath" 6 | "strings" 7 | "time" 8 | 9 | "github.com/howeyc/fsnotify" 10 | 11 | "github.com/astaxie/beego" 12 | "github.com/beego/compress" 13 | "github.com/beego/i18n" 14 | ) 15 | 16 | var ( 17 | CompressConfPath = "conf/compress.json" 18 | ) 19 | 20 | func initLocales() { 21 | // Initialized language type list. 22 | langs := strings.Split(beego.AppConfig.String("lang::types"), "|") 23 | names := strings.Split(beego.AppConfig.String("lang::names"), "|") 24 | langTypes = make([]*langType, 0, len(langs)) 25 | for i, v := range langs { 26 | langTypes = append(langTypes, &langType{ 27 | Lang: v, 28 | Name: names[i], 29 | }) 30 | } 31 | 32 | for _, lang := range langs { 33 | beego.Trace("Loading language: " + lang) 34 | if err := i18n.SetMessage(lang, "conf/"+"locale_"+lang+".ini"); err != nil { 35 | beego.Error("Fail to set message file: " + err.Error()) 36 | return 37 | } 38 | } 39 | } 40 | 41 | func settingCompress() { 42 | setting, err := compress.LoadJsonConf(CompressConfPath, IsPro, "/") 43 | if err != nil { 44 | beego.Error(err) 45 | return 46 | } 47 | 48 | setting.RunCommand() 49 | 50 | if IsPro { 51 | setting.RunCompress(true, false, true) 52 | } 53 | 54 | beego.AddFuncMap("compress_js", setting.Js.CompressJs) 55 | beego.AddFuncMap("compress_css", setting.Css.CompressCss) 56 | } 57 | 58 | func dict(values ...interface{}) (map[string]interface{}, error) { 59 | if len(values)%2 != 0 { 60 | return nil, errors.New("invalid dict call") 61 | } 62 | dict := make(map[string]interface{}, len(values)/2) 63 | for i := 0; i < len(values); i += 2 { 64 | key, ok := values[i].(string) 65 | if !ok { 66 | return nil, errors.New("dict keys must be strings") 67 | } 68 | dict[key] = values[i+1] 69 | } 70 | return dict, nil 71 | } 72 | 73 | func loadtimes(t time.Time) int { 74 | return int(time.Now().Sub(t).Nanoseconds() / 1e6) 75 | } 76 | 77 | func initTemplates() { 78 | beego.AddFuncMap("dict", dict) 79 | beego.AddFuncMap("loadtimes", loadtimes) 80 | } 81 | 82 | func InitApp() { 83 | initTemplates() 84 | initLocales() 85 | settingCompress() 86 | 87 | watcher, err := fsnotify.NewWatcher() 88 | if err != nil { 89 | panic("Failed start app watcher: " + err.Error()) 90 | } 91 | 92 | go func() { 93 | for { 94 | select { 95 | case event := <-watcher.Event: 96 | switch filepath.Ext(event.Name) { 97 | case ".ini": 98 | beego.Info(event) 99 | 100 | if err := i18n.ReloadLangs(); err != nil { 101 | beego.Error("Conf Reload: ", err) 102 | } 103 | 104 | beego.Info("Config Reloaded") 105 | 106 | case ".json": 107 | if event.Name == CompressConfPath { 108 | settingCompress() 109 | beego.Info("Beego Compress Reloaded") 110 | } 111 | } 112 | } 113 | } 114 | }() 115 | 116 | if err := watcher.WatchFlags("conf", fsnotify.FSN_MODIFY); err != nil { 117 | beego.Error(err) 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /routers/page.go: -------------------------------------------------------------------------------- 1 | package routers 2 | 3 | import ( 4 | "github.com/beego/beeweb/models" 5 | ) 6 | 7 | type PageRouter struct { 8 | baseRouter 9 | } 10 | 11 | func (this *PageRouter) Get() { 12 | this.Data["IsTeam"] = true 13 | this.TplName = "team.html" 14 | 15 | // Get language. 16 | df := models.GetDoc("team", this.Lang) 17 | this.Data["Title"] = df.Title 18 | this.Data["Data"] = string(df.Data) 19 | } 20 | 21 | type AboutRouter struct { 22 | baseRouter 23 | } 24 | 25 | func (this *AboutRouter) Get() { 26 | this.Data["IsAbout"] = true 27 | this.TplName = "about.html" 28 | 29 | // Get language. 30 | df := models.GetDoc("about", this.Lang) 31 | this.Data["Title"] = df.Title 32 | this.Data["Data"] = string(df.Data) 33 | } 34 | -------------------------------------------------------------------------------- /routers/products.go: -------------------------------------------------------------------------------- 1 | package routers 2 | 3 | import ( 4 | "github.com/beego/beeweb/models" 5 | ) 6 | 7 | type ProductsRouter struct { 8 | baseRouter 9 | } 10 | 11 | func (this *ProductsRouter) Get() { 12 | this.TplName = "products.html" 13 | this.Data["IsProducts"] = true 14 | this.Data["Products"] = models.Products 15 | } 16 | -------------------------------------------------------------------------------- /routers/quickstart.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package routers 16 | 17 | import ( 18 | "github.com/beego/beeweb/models" 19 | ) 20 | 21 | // QuickStartRouter serves about page. 22 | type QuickStartRouter struct { 23 | baseRouter 24 | } 25 | 26 | // Get implemented Get method for QuickStartRouter. 27 | func (this *QuickStartRouter) Get() { 28 | this.Data["IsQuickStart"] = true 29 | this.TplName = "quickstart.html" 30 | 31 | df := models.GetDoc("quickstart", this.Lang) 32 | this.Data["Section"] = "quickstart" 33 | this.Data["Title"] = df.Title 34 | this.Data["Data"] = string(df.Data) 35 | this.Data["IsHasMarkdown"] = true 36 | } 37 | -------------------------------------------------------------------------------- /routers/router.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | // Package routers implemented controller methods of beego. 16 | package routers 17 | 18 | import ( 19 | "strings" 20 | "time" 21 | 22 | "github.com/astaxie/beego" 23 | "github.com/beego/i18n" 24 | ) 25 | 26 | var ( 27 | AppVer string 28 | IsPro bool 29 | ) 30 | 31 | var langTypes []*langType // Languages are supported. 32 | 33 | // langType represents a language type. 34 | type langType struct { 35 | Lang, Name string 36 | } 37 | 38 | // baseRouter implemented global settings for all other routers. 39 | type baseRouter struct { 40 | beego.Controller 41 | i18n.Locale 42 | } 43 | 44 | // Prepare implemented Prepare method for baseRouter. 45 | func (this *baseRouter) Prepare() { 46 | // Setting properties. 47 | this.Data["AppVer"] = AppVer 48 | this.Data["IsPro"] = IsPro 49 | 50 | this.Data["PageStartTime"] = time.Now() 51 | 52 | // Redirect to make URL clean. 53 | if this.setLangVer() { 54 | i := strings.Index(this.Ctx.Request.RequestURI, "?") 55 | this.Redirect(this.Ctx.Request.RequestURI[:i], 302) 56 | return 57 | } 58 | } 59 | 60 | // setLangVer sets site language version. 61 | func (this *baseRouter) setLangVer() bool { 62 | isNeedRedir := false 63 | hasCookie := false 64 | 65 | // 1. Check URL arguments. 66 | lang := this.Input().Get("lang") 67 | 68 | // 2. Get language information from cookies. 69 | if len(lang) == 0 { 70 | lang = this.Ctx.GetCookie("lang") 71 | hasCookie = true 72 | } else { 73 | isNeedRedir = true 74 | } 75 | 76 | // Check again in case someone modify by purpose. 77 | if !i18n.IsExist(lang) { 78 | lang = "" 79 | isNeedRedir = false 80 | hasCookie = false 81 | } 82 | 83 | // 3. Get language information from 'Accept-Language'. 84 | if len(lang) == 0 { 85 | al := this.Ctx.Request.Header.Get("Accept-Language") 86 | if len(al) > 4 { 87 | al = al[:5] // Only compare first 5 letters. 88 | if i18n.IsExist(al) { 89 | lang = al 90 | } 91 | } 92 | } 93 | 94 | // 4. Default language is English. 95 | if len(lang) == 0 { 96 | lang = "en-US" 97 | isNeedRedir = false 98 | } 99 | 100 | curLang := langType{ 101 | Lang: lang, 102 | } 103 | 104 | // Save language information in cookies. 105 | if !hasCookie { 106 | this.Ctx.SetCookie("lang", curLang.Lang, 1<<31-1, "/") 107 | } 108 | 109 | restLangs := make([]*langType, 0, len(langTypes)-1) 110 | for _, v := range langTypes { 111 | if lang != v.Lang { 112 | restLangs = append(restLangs, v) 113 | } else { 114 | curLang.Name = v.Name 115 | } 116 | } 117 | 118 | // Set language properties. 119 | this.Lang = lang 120 | this.Data["Lang"] = curLang.Lang 121 | this.Data["CurLang"] = curLang.Name 122 | this.Data["RestLangs"] = restLangs 123 | 124 | return isNeedRedir 125 | } 126 | -------------------------------------------------------------------------------- /routers/samples.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package routers 16 | 17 | import ( 18 | "strings" 19 | 20 | "github.com/beego/beeweb/models" 21 | ) 22 | 23 | // SamplesRouter serves about page. 24 | type SamplesRouter struct { 25 | baseRouter 26 | } 27 | 28 | // Get implemented Get method for SamplesRouter. 29 | func (this *SamplesRouter) Get() { 30 | this.Data["IsSamples"] = true 31 | 32 | reqUrl := this.Ctx.Request.URL.String() 33 | sec := reqUrl[strings.LastIndex(reqUrl, "/")+1:] 34 | if qm := strings.Index(sec, "?"); qm > -1 { 35 | sec = sec[:qm] 36 | } 37 | 38 | if len(sec) == 0 || sec == "samples" { 39 | this.Redirect("/samples/Samples_Introduction", 302) 40 | return 41 | } else { 42 | this.Data[sec] = true 43 | } 44 | 45 | // Get language. 46 | curLang, _ := this.Data["LangVer"].(langType) 47 | df := models.GetDoc(sec, curLang.Lang) 48 | if df == nil { 49 | this.Redirect("/samples/Samples_Introduction", 302) 50 | return 51 | } 52 | 53 | this.Data["Title"] = df.Title 54 | this.Data["Data"] = string(df.Data) 55 | this.Data["IsHasMarkdown"] = true 56 | this.TplName = "samples_" + curLang.Lang + ".html" 57 | } 58 | -------------------------------------------------------------------------------- /routers/video.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Beego Web authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package routers 16 | 17 | import "github.com/beego/beeweb/models" 18 | 19 | // HomeRouter serves home page. 20 | type VideoRouter struct { 21 | baseRouter 22 | } 23 | 24 | // Get implemented Get method for VideoRouter. 25 | func (this *VideoRouter) Get() { 26 | this.Data["IsVideo"] = true 27 | this.TplName = "video.html" 28 | 29 | df := models.GetDoc("screencasts", this.Lang) 30 | this.Data["Section"] = "screencasts" 31 | this.Data["Data"] = string(df.Data) 32 | this.Data["IsHasMarkdown"] = true 33 | } 34 | -------------------------------------------------------------------------------- /static/font/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/font/FontAwesome.otf -------------------------------------------------------------------------------- /static/font/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/font/fontawesome-webfont.eot -------------------------------------------------------------------------------- /static/font/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/font/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /static/font/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/font/fontawesome-webfont.woff -------------------------------------------------------------------------------- /static/img/alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/alipay.png -------------------------------------------------------------------------------- /static/img/arrow left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | arrow left 4 | Created with Sketch (http://www.bohemiancoding.com/sketch) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /static/img/arrow right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | arror right 4 | Created with Sketch (http://www.bohemiancoding.com/sketch) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /static/img/avatar/64f3f973dcfa1d34af6a6297f8bc393b_normal.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/avatar/64f3f973dcfa1d34af6a6297f8bc393b_normal.jpeg -------------------------------------------------------------------------------- /static/img/avatar/654bd33f0c2a96261f38895e1f7e9ce8_normal.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/avatar/654bd33f0c2a96261f38895e1f7e9ce8_normal.jpeg -------------------------------------------------------------------------------- /static/img/avatar/jemeshsu-04_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/avatar/jemeshsu-04_normal.png -------------------------------------------------------------------------------- /static/img/bee.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/bee.gif -------------------------------------------------------------------------------- /static/img/bee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/bee.png -------------------------------------------------------------------------------- /static/img/bee_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/bee_64.png -------------------------------------------------------------------------------- /static/img/beego_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/beego_logo.png -------------------------------------------------------------------------------- /static/img/beego_logo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/beego_logo2.png -------------------------------------------------------------------------------- /static/img/beego_mdongorg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/beego_mdongorg.png -------------------------------------------------------------------------------- /static/img/beego_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/beego_purple.png -------------------------------------------------------------------------------- /static/img/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/bg.jpg -------------------------------------------------------------------------------- /static/img/brands/17173.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/17173.png -------------------------------------------------------------------------------- /static/img/brands/360.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/360.png -------------------------------------------------------------------------------- /static/img/brands/ardanstudios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/ardanstudios.png -------------------------------------------------------------------------------- /static/img/brands/bmob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/bmob.png -------------------------------------------------------------------------------- /static/img/brands/hwclouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/hwclouds.png -------------------------------------------------------------------------------- /static/img/brands/jd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/jd.png -------------------------------------------------------------------------------- /static/img/brands/letvcloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/letvcloud.png -------------------------------------------------------------------------------- /static/img/brands/lianjia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/lianjia.png -------------------------------------------------------------------------------- /static/img/brands/lianzong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/lianzong.png -------------------------------------------------------------------------------- /static/img/brands/meituan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/meituan.png -------------------------------------------------------------------------------- /static/img/brands/oupeng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/oupeng.png -------------------------------------------------------------------------------- /static/img/brands/snda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/snda.png -------------------------------------------------------------------------------- /static/img/brands/taobao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/taobao.png -------------------------------------------------------------------------------- /static/img/brands/tencent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/tencent.png -------------------------------------------------------------------------------- /static/img/brands/tudou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/tudou.png -------------------------------------------------------------------------------- /static/img/brands/weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/weibo.png -------------------------------------------------------------------------------- /static/img/brands/weico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/weico.png -------------------------------------------------------------------------------- /static/img/brands/wepiao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/wepiao.png -------------------------------------------------------------------------------- /static/img/brands/youdao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/youdao.png -------------------------------------------------------------------------------- /static/img/brands/zalora.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/brands/zalora.png -------------------------------------------------------------------------------- /static/img/community/IRC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/community/IRC.png -------------------------------------------------------------------------------- /static/img/community/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/community/github.png -------------------------------------------------------------------------------- /static/img/community/google-groups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/community/google-groups.png -------------------------------------------------------------------------------- /static/img/community/stackoverflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/community/stackoverflow.png -------------------------------------------------------------------------------- /static/img/community/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/community/twitter.png -------------------------------------------------------------------------------- /static/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/favicon.png -------------------------------------------------------------------------------- /static/img/footer-links.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/footer-links.png -------------------------------------------------------------------------------- /static/img/fork-us-on-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beego/beeweb/573258e9f28324a74b0c3c3a4045cf66c3209b19/static/img/fork-us-on-github.png -------------------------------------------------------------------------------- /static_source/css/base.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | } 4 | 5 | body { 6 | font-size: 14px; 7 | background-color: #f5f5f5; 8 | } 9 | 10 | body, 11 | h1, 12 | h2, 13 | h3, 14 | h4, 15 | h5, 16 | h6, 17 | .h1, 18 | .h2, 19 | .h3, 20 | .h4, 21 | .h5, 22 | .h6 { 23 | font-family: "ff-tisa-web-pro-1","ff-tisa-web-pro-2","Helvetica Neue",Helvetica,"Lucida Grande","Hiragino Sans GB","Microsoft YaHei", \5fae\8f6f\96c5\9ed1,"WenQuanYi Micro Hei",sans-serif; 24 | } 25 | 26 | label { 27 | cursor: pointer; 28 | } 29 | 30 | textarea, 31 | textarea.form-control { 32 | padding: 10px; 33 | } 34 | 35 | .navbar { 36 | font-size: 16px; 37 | } 38 | 39 | .navbar .logo img { 40 | height: 32px; 41 | margin: 8px 15px 0 10px; 42 | } 43 | 44 | .navbar .navbar-menu li.has-icon > a { 45 | width: 35px; 46 | padding: 0; 47 | } 48 | 49 | .navbar .navbar-menu li.has-icon .icon { 50 | font-size: 20px; 51 | line-height: 40px; 52 | height: 40px; 53 | margin-left: 10px; 54 | } 55 | 56 | .navbar .navbar-menu .avatar > a { 57 | display: block; 58 | padding: 3px; 59 | } 60 | 61 | .navbar .navbar-menu .avatar > a > img { 62 | width: 34px; 63 | height: 34px; 64 | padding: 2px; 65 | border: 2px solid #e6e6e6; 66 | display: block; 67 | background-color: #eee; 68 | } 69 | 70 | #main { 71 | padding-top: 51px; 72 | } 73 | 74 | #wrapper { 75 | min-height: 100% !important; 76 | height: auto !important; 77 | height: 100%; 78 | margin: 0 auto -165px; 79 | } 80 | 81 | #wrapper .wrapper-push { 82 | height: 165px; 83 | } 84 | 85 | #content .box, 86 | #sidebar .box { 87 | margin-bottom: 10px 88 | } 89 | 90 | /* footer */ 91 | #footer { 92 | background: #fff; 93 | -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05); 94 | box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);; 95 | margin-top: 65px; 96 | } 97 | 98 | #footer .footer-wrap { 99 | padding: 20px 0; 100 | } 101 | 102 | #footer .desc { 103 | color: #ababab; 104 | } 105 | 106 | /* box */ 107 | .box { 108 | background-color: #fafafa; 109 | border-bottom: 1px solid #e2e2e2; 110 | border-radius: 3px; 111 | -webkit-box-shadow: 1px 0 4px rgba(0, 0, 0, 0.20); 112 | box-shadow: 1px 0 4px rgba(0, 0, 0, 0.20); 113 | } 114 | 115 | .box.nobg { 116 | background: none; 117 | border: none; 118 | -webkit-box-shadow: none; 119 | box-shadow: none; 120 | } 121 | 122 | .cell { 123 | padding: 10px 10px; 124 | border-top: 2px solid #fff; 125 | border-bottom: 1px solid #e2e2e2; 126 | } 127 | 128 | .cell.first { 129 | border-top-left-radius: 3px; 130 | border-top-right-radius: 3px; 131 | } 132 | 133 | .cell.last { 134 | border-bottom-left-radius: 3px; 135 | border-bottom-right-radius: 3px; 136 | } 137 | 138 | .cell.slim { 139 | padding-right: 25px; 140 | padding-left: 25px; 141 | } 142 | 143 | .cell.low { 144 | padding-top: 5px; 145 | padding-bottom: 5px; 146 | } 147 | 148 | /* pager */ 149 | 150 | .box .pagination, 151 | .box .pager { 152 | margin: 0; 153 | } 154 | 155 | .pager .pager-nums { 156 | line-height: 30px; 157 | } 158 | 159 | /* avatar */ 160 | .avatar img { 161 | border-radius: 3px; 162 | width: 48px; 163 | height: 48px; 164 | } 165 | 166 | .avatar a { 167 | text-decoration: none; 168 | } 169 | 170 | .avatar img.large { 171 | width: 64px; 172 | height: 64px; 173 | } 174 | 175 | .avatar img.middle { 176 | width: 32px; 177 | height: 32px; 178 | } 179 | 180 | .avatar img.small { 181 | width: 16px; 182 | height: 16px; 183 | } 184 | 185 | /* breadcrumb */ 186 | .breadcrumb { 187 | font-size: 14px; 188 | background-color: #f3f3f3; 189 | color: #666; 190 | } 191 | 192 | .breadcrumb .icon { 193 | font-size: 16px; 194 | } 195 | 196 | .breadcrumb .divider { 197 | font-size: 14px; 198 | font-weight: bold; 199 | padding: 0 5px; 200 | margin: 0 5px; 201 | } 202 | 203 | /* btn-checked */ 204 | .btn-checked, 205 | .btn-checked:hover, 206 | .btn-checked:focus { 207 | margin-top: -3px; 208 | margin-right: 8px; 209 | color: #ccc; 210 | } 211 | 212 | .btn-checked.active { 213 | color: #000; 214 | } 215 | 216 | /* dropdown-menu */ 217 | .dropdown-menu > li > a:focus { 218 | color: rgb(255, 255, 255); 219 | background-color: rgb(0, 131, 174); 220 | background-image: linear-gradient(to bottom, rgb(0, 139, 184), rgb(0, 120, 159)); 221 | } 222 | .dropdown-menu > li > a:hover { 223 | color: rgb(255, 255, 255); 224 | background-color: rgb(0, 131, 174); 225 | background-image: linear-gradient(to bottom, rgb(0, 139, 184), rgb(0, 120, 159)); 226 | } 227 | 228 | /* form help block */ 229 | .help-block { 230 | margin-left: 5px; 231 | } 232 | 233 | /* form error block */ 234 | .form-group .error-block { 235 | z-index: -1; 236 | display: none; 237 | } 238 | 239 | .form-group.has-error .error-block, 240 | .form-group.has-warning .error-block { 241 | display: inline-block; 242 | padding: 3px 5px; 243 | font-size: 12px; 244 | margin: 0 5px; 245 | color: #b94a48; 246 | border-bottom-left-radius: 3px; 247 | border-bottom-right-radius: 3px; 248 | background-color: #f2dede; 249 | border: 1px solid #c09853; 250 | border-top: none; 251 | } 252 | 253 | .form-group.has-warning .error-block { 254 | background-color: #EFC994; 255 | border: 1px solid #eea236; 256 | border-top: none; 257 | } 258 | 259 | .error-block .btn { 260 | margin-top: 2px; 261 | } 262 | 263 | h1.underline, 264 | h2.underline, 265 | h3.underline, 266 | h4.underline, 267 | h5.underline, 268 | h6.underline { 269 | padding: 0 0 15px; 270 | margin-bottom: 20px; 271 | border-bottom: 1px solid #ccc; 272 | } 273 | 274 | .alert.alert-small { 275 | padding: 8px 10px; 276 | margin-bottom: 15px; 277 | } 278 | 279 | .color-checked { 280 | color: #02A779; 281 | } 282 | 283 | .color-orange { 284 | color: #F3813A; 285 | } 286 | 287 | .color-red { 288 | color: #F24A39; 289 | } 290 | 291 | a.color-link, 292 | .color-link a, 293 | a.color-link-hover:hover { 294 | color: #2892BC; 295 | } 296 | 297 | a.color-link:hover, 298 | .color-link a:hover { 299 | color: #146B8E; 300 | } 301 | 302 | .btn.disabled:active, 303 | .btn.disabled:focus, 304 | .btn.disabled:hover, 305 | .btn.disabled { 306 | background-image: none; 307 | background-color: #ddd; 308 | } 309 | 310 | /* dropdown login */ 311 | #dropdown-login { 312 | width: 280px; 313 | } 314 | -------------------------------------------------------------------------------- /static_source/css/bootstrap-theme.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.0 by @fat and @mdo 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | * 6 | * Designed and built with all the love in the world by @mdo and @fat. 7 | */ 8 | .btn-default, 9 | .btn-primary, 10 | .btn-success, 11 | .btn-info, 12 | .btn-warning, 13 | .btn-danger { 14 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); 15 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); 16 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); 17 | } 18 | 19 | .btn-default:active, 20 | .btn-primary:active, 21 | .btn-success:active, 22 | .btn-info:active, 23 | .btn-warning:active, 24 | .btn-danger:active, 25 | .btn-default.active, 26 | .btn-primary.active, 27 | .btn-success.active, 28 | .btn-info.active, 29 | .btn-warning.active, 30 | .btn-danger.active { 31 | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); 32 | box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); 33 | } 34 | 35 | .btn:active, 36 | .btn.active { 37 | background-image: none; 38 | } 39 | 40 | .btn-default { 41 | text-shadow: 0 1px 0 #fff; 42 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#e0e0e0)); 43 | background-image: -webkit-linear-gradient(top, #ffffff, 0%, #e0e0e0, 100%); 44 | background-image: -moz-linear-gradient(top, #ffffff 0%, #e0e0e0 100%); 45 | background-image: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 100%); 46 | background-repeat: repeat-x; 47 | border-color: #dbdbdb; 48 | border-color: #ccc; 49 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); 50 | } 51 | 52 | .btn-default:hover, 53 | .btn-default:focus { 54 | background-color: #e0e0e0; 55 | background-position: 0 -15px; 56 | } 57 | 58 | .btn-default:active, 59 | .btn-default.active { 60 | background-color: #e0e0e0; 61 | border-color: #dbdbdb; 62 | } 63 | 64 | .btn-primary { 65 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#2d6ca2)); 66 | background-image: -webkit-linear-gradient(top, #428bca, 0%, #2d6ca2, 100%); 67 | background-image: -moz-linear-gradient(top, #428bca 0%, #2d6ca2 100%); 68 | background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%); 69 | background-repeat: repeat-x; 70 | border-color: #2b669a; 71 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0); 72 | } 73 | 74 | .btn-primary:hover, 75 | .btn-primary:focus { 76 | background-color: #2d6ca2; 77 | background-position: 0 -15px; 78 | } 79 | 80 | .btn-primary:active, 81 | .btn-primary.active { 82 | background-color: #2d6ca2; 83 | border-color: #2b669a; 84 | } 85 | 86 | .btn-success { 87 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#419641)); 88 | background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #419641, 100%); 89 | background-image: -moz-linear-gradient(top, #5cb85c 0%, #419641 100%); 90 | background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); 91 | background-repeat: repeat-x; 92 | border-color: #3e8f3e; 93 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0); 94 | } 95 | 96 | .btn-success:hover, 97 | .btn-success:focus { 98 | background-color: #419641; 99 | background-position: 0 -15px; 100 | } 101 | 102 | .btn-success:active, 103 | .btn-success.active { 104 | background-color: #419641; 105 | border-color: #3e8f3e; 106 | } 107 | 108 | .btn-warning { 109 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#eb9316)); 110 | background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #eb9316, 100%); 111 | background-image: -moz-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); 112 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); 113 | background-repeat: repeat-x; 114 | border-color: #e38d13; 115 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0); 116 | } 117 | 118 | .btn-warning:hover, 119 | .btn-warning:focus { 120 | background-color: #eb9316; 121 | background-position: 0 -15px; 122 | } 123 | 124 | .btn-warning:active, 125 | .btn-warning.active { 126 | background-color: #eb9316; 127 | border-color: #e38d13; 128 | } 129 | 130 | .btn-danger { 131 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c12e2a)); 132 | background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c12e2a, 100%); 133 | background-image: -moz-linear-gradient(top, #d9534f 0%, #c12e2a 100%); 134 | background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); 135 | background-repeat: repeat-x; 136 | border-color: #b92c28; 137 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0); 138 | } 139 | 140 | .btn-danger:hover, 141 | .btn-danger:focus { 142 | background-color: #c12e2a; 143 | background-position: 0 -15px; 144 | } 145 | 146 | .btn-danger:active, 147 | .btn-danger.active { 148 | background-color: #c12e2a; 149 | border-color: #b92c28; 150 | } 151 | 152 | .btn-info { 153 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#2aabd2)); 154 | background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #2aabd2, 100%); 155 | background-image: -moz-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); 156 | background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); 157 | background-repeat: repeat-x; 158 | border-color: #28a4c9; 159 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0); 160 | } 161 | 162 | .btn-info:hover, 163 | .btn-info:focus { 164 | background-color: #2aabd2; 165 | background-position: 0 -15px; 166 | } 167 | 168 | .btn-info:active, 169 | .btn-info.active { 170 | background-color: #2aabd2; 171 | border-color: #28a4c9; 172 | } 173 | 174 | .thumbnail, 175 | .img-thumbnail { 176 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 177 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 178 | } 179 | 180 | .dropdown-menu > li > a:hover, 181 | .dropdown-menu > li > a:focus { 182 | background-color: #e8e8e8; 183 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8)); 184 | background-image: -webkit-linear-gradient(top, #f5f5f5, 0%, #e8e8e8, 100%); 185 | background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 186 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); 187 | background-repeat: repeat-x; 188 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); 189 | } 190 | 191 | .dropdown-menu > .active > a, 192 | .dropdown-menu > .active > a:hover, 193 | .dropdown-menu > .active > a:focus { 194 | background-color: #357ebd; 195 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd)); 196 | background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%); 197 | background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%); 198 | background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); 199 | background-repeat: repeat-x; 200 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); 201 | } 202 | 203 | .navbar-default { 204 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#f8f8f8)); 205 | background-image: -webkit-linear-gradient(top, #ffffff, 0%, #f8f8f8, 100%); 206 | background-image: -moz-linear-gradient(top, #ffffff 0%, #f8f8f8 100%); 207 | background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%); 208 | background-repeat: repeat-x; 209 | border-radius: 4px; 210 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); 211 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 212 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); 213 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); 214 | } 215 | 216 | .navbar-brand, 217 | .navbar-nav > li > a { 218 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); 219 | } 220 | 221 | .navbar-inverse { 222 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#3c3c3c), to(#222222)); 223 | background-image: -webkit-linear-gradient(top, #3c3c3c, 0%, #222222, 100%); 224 | background-image: -moz-linear-gradient(top, #3c3c3c 0%, #222222 100%); 225 | background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%); 226 | background-repeat: repeat-x; 227 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); 228 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 229 | } 230 | 231 | .navbar-inverse .navbar-nav > .active > a { 232 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#222222), to(#282828)); 233 | background-image: -webkit-linear-gradient(top, #222222, 0%, #282828, 100%); 234 | background-image: -moz-linear-gradient(top, #222222 0%, #282828 100%); 235 | background-image: linear-gradient(to bottom, #222222 0%, #282828 100%); 236 | background-repeat: repeat-x; 237 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0); 238 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25); 239 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25); 240 | } 241 | 242 | .navbar-inverse .navbar-brand, 243 | .navbar-inverse .navbar-nav > li > a { 244 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 245 | } 246 | 247 | .navbar-static-top, 248 | .navbar-fixed-top, 249 | .navbar-fixed-bottom { 250 | border-radius: 0; 251 | } 252 | 253 | .alert { 254 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2); 255 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); 256 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); 257 | } 258 | 259 | .alert-success { 260 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#c8e5bc)); 261 | background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #c8e5bc, 100%); 262 | background-image: -moz-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); 263 | background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); 264 | background-repeat: repeat-x; 265 | border-color: #b2dba1; 266 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); 267 | } 268 | 269 | .alert-info { 270 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#b9def0)); 271 | background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #b9def0, 100%); 272 | background-image: -moz-linear-gradient(top, #d9edf7 0%, #b9def0 100%); 273 | background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); 274 | background-repeat: repeat-x; 275 | border-color: #9acfea; 276 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); 277 | } 278 | 279 | .alert-warning { 280 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#f8efc0)); 281 | background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #f8efc0, 100%); 282 | background-image: -moz-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); 283 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); 284 | background-repeat: repeat-x; 285 | border-color: #f5e79e; 286 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); 287 | } 288 | 289 | .alert-danger { 290 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#e7c3c3)); 291 | background-image: -webkit-linear-gradient(top, #f2dede, 0%, #e7c3c3, 100%); 292 | background-image: -moz-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); 293 | background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); 294 | background-repeat: repeat-x; 295 | border-color: #dca7a7; 296 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); 297 | } 298 | 299 | .progress { 300 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ebebeb), to(#f5f5f5)); 301 | background-image: -webkit-linear-gradient(top, #ebebeb, 0%, #f5f5f5, 100%); 302 | background-image: -moz-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); 303 | background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); 304 | background-repeat: repeat-x; 305 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); 306 | } 307 | 308 | .progress-bar { 309 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9)); 310 | background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%); 311 | background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%); 312 | background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%); 313 | background-repeat: repeat-x; 314 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0); 315 | } 316 | 317 | .progress-bar-success { 318 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44)); 319 | background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%); 320 | background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%); 321 | background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); 322 | background-repeat: repeat-x; 323 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); 324 | } 325 | 326 | .progress-bar-info { 327 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5)); 328 | background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%); 329 | background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); 330 | background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); 331 | background-repeat: repeat-x; 332 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); 333 | } 334 | 335 | .progress-bar-warning { 336 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f)); 337 | background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%); 338 | background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); 339 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); 340 | background-repeat: repeat-x; 341 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); 342 | } 343 | 344 | .progress-bar-danger { 345 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c)); 346 | background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%); 347 | background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%); 348 | background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); 349 | background-repeat: repeat-x; 350 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); 351 | } 352 | 353 | .list-group { 354 | border-radius: 4px; 355 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 356 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 357 | } 358 | 359 | .list-group-item.active, 360 | .list-group-item.active:hover, 361 | .list-group-item.active:focus { 362 | text-shadow: 0 -1px 0 #3071a9; 363 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3278b3)); 364 | background-image: -webkit-linear-gradient(top, #428bca, 0%, #3278b3, 100%); 365 | background-image: -moz-linear-gradient(top, #428bca 0%, #3278b3 100%); 366 | background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%); 367 | background-repeat: repeat-x; 368 | border-color: #3278b3; 369 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0); 370 | } 371 | 372 | .panel { 373 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 374 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 375 | } 376 | 377 | .panel-default > .panel-heading { 378 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8)); 379 | background-image: -webkit-linear-gradient(top, #f5f5f5, 0%, #e8e8e8, 100%); 380 | background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 381 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); 382 | background-repeat: repeat-x; 383 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); 384 | } 385 | 386 | .panel-primary > .panel-heading { 387 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd)); 388 | background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%); 389 | background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%); 390 | background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); 391 | background-repeat: repeat-x; 392 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); 393 | } 394 | 395 | .panel-success > .panel-heading { 396 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#d0e9c6)); 397 | background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #d0e9c6, 100%); 398 | background-image: -moz-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); 399 | background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); 400 | background-repeat: repeat-x; 401 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); 402 | } 403 | 404 | .panel-info > .panel-heading { 405 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#c4e3f3)); 406 | background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #c4e3f3, 100%); 407 | background-image: -moz-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); 408 | background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); 409 | background-repeat: repeat-x; 410 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); 411 | } 412 | 413 | .panel-warning > .panel-heading { 414 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#faf2cc)); 415 | background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #faf2cc, 100%); 416 | background-image: -moz-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); 417 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); 418 | background-repeat: repeat-x; 419 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); 420 | } 421 | 422 | .panel-danger > .panel-heading { 423 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#ebcccc)); 424 | background-image: -webkit-linear-gradient(top, #f2dede, 0%, #ebcccc, 100%); 425 | background-image: -moz-linear-gradient(top, #f2dede 0%, #ebcccc 100%); 426 | background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); 427 | background-repeat: repeat-x; 428 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); 429 | } 430 | 431 | .well { 432 | background-image: -webkit-gradient(linear, left 0%, left 100%, from(#e8e8e8), to(#f5f5f5)); 433 | background-image: -webkit-linear-gradient(top, #e8e8e8, 0%, #f5f5f5, 100%); 434 | background-image: -moz-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); 435 | background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); 436 | background-repeat: repeat-x; 437 | border-color: #dcdcdc; 438 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); 439 | -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); 440 | box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); 441 | } -------------------------------------------------------------------------------- /static_source/css/main.css: -------------------------------------------------------------------------------- 1 | /* sidebar */ 2 | .sidebar-list { 3 | padding-left: 20px; 4 | } 5 | 6 | .sidebar-list li { 7 | margin-bottom: 5px; 8 | } 9 | 10 | .main-header { 11 | padding: 80px 0 30px; 12 | background-color: #3483A5; 13 | background-image: linear-gradient(to bottom, #328BB1, #4baad3); 14 | text-align: center; 15 | margin-bottom: 10px; 16 | } 17 | 18 | .main-header .title { 19 | color: #fff; 20 | font-size: 50px; 21 | text-shadow: 1px 1px 2px rgba(0,0,0,0.25); 22 | } 23 | 24 | .main-header .desc { 25 | color: #eee; 26 | margin: 20px 0 0; 27 | font-size: 20px; 28 | text-shadow: 1px 1px 2px rgba(0,0,0,0.25); 29 | } 30 | 31 | .main-header .actions { 32 | color: #eee; 33 | margin: 40px 0 0; 34 | font-size: 20px; 35 | text-shadow: 1px 1px 2px rgba(0,0,0,0.25); 36 | } 37 | 38 | .main-container { 39 | margin-top: 31px; 40 | } 41 | 42 | .home-box .markdown { 43 | margin-bottom: 10px; 44 | } 45 | 46 | .home-box h2 { 47 | margin-top: 0; 48 | color: #f04c5c; 49 | text-shadow: 1px 1px 1px rgba(0,0,0,0.15); 50 | border-bottom: 1px solid #DDD; 51 | margin: 15px 0; 52 | padding: 0; 53 | line-height: 1.7; 54 | } 55 | 56 | .home-box .feature { 57 | text-align: center; 58 | margin: 40px 0 30px; 59 | } 60 | 61 | .home-box .feature .icon { 62 | color: #f04c5c; 63 | text-shadow: 1px 1px 1px rgba(0,0,0,0.15); 64 | font-size: 70px; 65 | height: 70px; 66 | display: block; 67 | } 68 | 69 | .home-box .feature .title { 70 | margin: 20px 0 0; 71 | font-size: 18px; 72 | } 73 | 74 | .home-box .feature .content { 75 | margin: 25px 0 20px; 76 | padding: 0 10px; 77 | line-height: 1.6; 78 | letter-spacing: 1px; 79 | text-align: left; 80 | } 81 | 82 | .home-box .whouse img { 83 | margin: 5px 0 0; 84 | } 85 | 86 | .page-header { 87 | padding-bottom: 8px; 88 | margin: 36px 0 18px; 89 | border-bottom: none; 90 | } 91 | 92 | .page-box { 93 | padding-bottom: 50px !important; 94 | } 95 | 96 | /* ****************************** 97 | For the getting started page 98 | ****************************** */ 99 | .option-chooser-blocks { 100 | position: relative; 101 | margin-left: -8px; 102 | } 103 | .option-chooser-blocks img { 104 | opacity: 0.8; 105 | padding: 0 10px; 106 | } 107 | .option-chooser-blocks a { 108 | color: black; 109 | } 110 | .option-chooser-blocks li { 111 | list-style-type: none; 112 | display: block; 113 | float: left; 114 | height: 115px; 115 | width: 115px; 116 | background-color: #eaeaea; 117 | border: 2px solid #b0c0bf; 118 | margin: 6px; 119 | text-align: center; 120 | padding: 5px; 121 | } 122 | .option-chooser-blocks li:hover { 123 | background-color: #d1d1d1; 124 | } 125 | /* ****************************** 126 | For the community page 127 | ****************************** */ 128 | .botbot-button { 129 | background-color: #de6222; 130 | padding: 4px; 131 | height: 60px; 132 | } 133 | .botbot-button img { 134 | height: 50px; 135 | float: left; 136 | } 137 | .botbot-button .bbme-title { 138 | font-size: larger; 139 | color: white; 140 | } 141 | #navlist{ 142 | position: fixed; 143 | z-index: 999; 144 | top: 80px; 145 | } 146 | /* ****************************** 147 | For the github btn 148 | ****************************** */ 149 | .github-btn { 150 | font-size: 11px; 151 | } 152 | .github-btn, 153 | .github-btn .btn { 154 | font-weight: bold; 155 | } 156 | .gh-count{ 157 | padding: 2px 5px 3px 4px; 158 | color: #555; 159 | text-decoration: none; 160 | text-shadow:0 1px 0 #fff; 161 | white-space:nowrap; 162 | cursor:pointer; 163 | border-radius:3px; 164 | position:relative; 165 | display:none; 166 | margin-left:4px; 167 | background-color:#fafafa; 168 | border:1px solid #d4d4d4; 169 | } 170 | .gh-count:hover,.gh-count:focus{color:#4183c4;text-decoration: none;} 171 | .gh-count:before,.gh-count:after{content:' ';position:absolute;display:inline-block;width:0;height:0;border-color:transparent;border-style:solid} 172 | .gh-count:before{top:50%;left:-3px;margin-top:-4px;border-width:4px 4px 4px 0;border-right-color:#fafafa} 173 | .gh-count:after{top:50%;left:-4px;z-index:-1;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#d4d4d4} 174 | 175 | .docs-sidenav { 176 | max-height: none; 177 | } 178 | 179 | .docs-sidenav .section { 180 | color: #aaa; 181 | } 182 | 183 | .docs-sidenav > .section { 184 | font-size: 16px; 185 | margin: 0 0 15px; 186 | } 187 | 188 | .docs-sidenav .group { 189 | margin: 9px 0; 190 | } 191 | 192 | .docs-sidenav ul ul { 193 | padding: 0 0 0 10px; 194 | } 195 | 196 | .docs-sidenav ul li { 197 | padding: 3px 0 0; 198 | } 199 | 200 | .docs-sidenav a { 201 | color: #3483A5; 202 | text-decoration: none; 203 | } 204 | 205 | .docs-sidenav a:hover, 206 | .docs-sidenav a.active { 207 | color: #f04c5c; 208 | } 209 | 210 | #docs-collapse-btn { 211 | margin: 8px 0 8px 15px; 212 | float: left; 213 | font-weight: bold; 214 | height: 34px; 215 | width: 44px; 216 | line-height: 12px; 217 | text-decoration: none; 218 | padding: 8px 0 8px 18px; 219 | border: 1px solid #ddd; 220 | border-radius: 4px; 221 | } 222 | 223 | .docs-markdown .anchor-wrap { 224 | margin-top: -50px; 225 | padding-top: 50px; 226 | } 227 | 228 | .docs-markdown h1 a, .docs-markdown h2 a, .docs-markdown h3 a { 229 | color: #4183c4; 230 | text-decoration: none; 231 | } 232 | 233 | .docs-markdown h1 a.anchor, 234 | .docs-markdown h2 a.anchor, 235 | .docs-markdown h3 a.anchor, 236 | .docs-markdown h4 a.anchor, 237 | .docs-markdown h5 a.anchor, 238 | .docs-markdown h6 a.anchor { 239 | text-decoration:none; 240 | line-height:1; 241 | padding-left:0; 242 | margin-left:5px; 243 | top:15%; 244 | } 245 | 246 | .docs-markdown a span.octicon { 247 | font-size: 16px; 248 | font-family: "FontAwesome"; 249 | line-height: 1; 250 | display: inline-block; 251 | text-decoration: none; 252 | -webkit-font-smoothing: antialiased; 253 | } 254 | 255 | .docs-markdown a span.octicon-link { 256 | display: none; 257 | color: #000; 258 | } 259 | 260 | .docs-markdown a span.octicon-link:before { 261 | content: "\f0c1"; 262 | } 263 | 264 | .docs-markdown h1:hover .octicon-link, 265 | .docs-markdown h2:hover .octicon-link, 266 | .docs-markdown h3:hover .octicon-link, 267 | .docs-markdown h4:hover .octicon-link, 268 | .docs-markdown h5:hover .octicon-link, 269 | .docs-markdown h6:hover .octicon-link { 270 | display:inline-block 271 | } 272 | 273 | .nav-lang { 274 | margin: 12px 0 0 10px; 275 | } 276 | 277 | .nav-github { 278 | margin: 12px 0 0 10px; 279 | display: inline-block; 280 | } 281 | 282 | #jPanelMenu-menu { 283 | max-height: none; 284 | padding: 75px 15px 0; 285 | background: #328BB1; 286 | z-index: 1; 287 | } 288 | 289 | #jPanelMenu-menu.docs-sidenav .section { 290 | color: #fff; 291 | } 292 | 293 | #jPanelMenu-menu.docs-sidenav a { 294 | color: #ddd; 295 | text-decoration: none; 296 | } 297 | 298 | #jPanelMenu-menu.docs-sidenav a:hover, 299 | #jPanelMenu-menu.docs-sidenav a.active { 300 | color: #f04c5c; 301 | } 302 | 303 | /* line 3, clingify.scss */ 304 | .js-clingify-ztransform, .js-clingify-wrapper { 305 | -webkit-transform: translateZ(0); 306 | -moz-transform: translateZ(0); 307 | -ms-transform: translateZ(0); 308 | -o-transform: translateZ(0); 309 | transform: translateZ(0); 310 | } 311 | 312 | /* Baseline selectors */ 313 | /* line 10, clingify.scss */ 314 | .js-clingify-wrapper { 315 | width: 100%; 316 | } 317 | 318 | /* line 14, clingify.scss */ 319 | .js-clingify-locked { 320 | left: 0; 321 | position: fixed; 322 | top: 0; 323 | z-index: 99999; 324 | } 325 | 326 | #disqus_thread { 327 | margin: 20px 0 0 0; 328 | padding: 0 9px; 329 | } 330 | 331 | #products .product-head { 332 | margin: 0 0 20px; 333 | } 334 | 335 | #products .product-head h2 { 336 | margin: 0 0 20px; 337 | } 338 | 339 | #products .product .box { 340 | margin: 15px 0 0 0; 341 | padding: 10px; 342 | } 343 | 344 | #products .product h3 { 345 | margin: 0 0 15px; 346 | font-size: 18px; 347 | } 348 | 349 | #products .product img { 350 | border-radius: 4px; 351 | } 352 | 353 | #products .product .desc { 354 | margin: 0 0 15px; 355 | font-size: 14px; 356 | } 357 | 358 | #products .product .meta { 359 | margin: 15px 0 0; 360 | color: #999; 361 | } 362 | 363 | #products .product-head a, 364 | #products .product .meta a { 365 | color: #3483A5; 366 | } 367 | -------------------------------------------------------------------------------- /static_source/css/markdown.css: -------------------------------------------------------------------------------- 1 | .markdown { 2 | font-size: 14px; 3 | } 4 | 5 | .markdown a { 6 | color: #4183C4; 7 | } 8 | 9 | .markdown h1, 10 | .markdown h2, 11 | .markdown h3, 12 | .markdown h4, 13 | .markdown h5, 14 | .markdown h6 { 15 | line-height: 1.7; 16 | padding: 15px 0 0; 17 | margin: 0 0 15px; 18 | color: #666; 19 | } 20 | 21 | .markdown h1, 22 | .markdown h2 { 23 | border-bottom: 1px solid #EEE; 24 | } 25 | 26 | .markdown h2 { 27 | border-bottom: 1px solid #EEE; 28 | } 29 | 30 | .markdown h1 { 31 | color: #000; 32 | font-size: 33px 33 | } 34 | 35 | .markdown h2 { 36 | color: #333; 37 | font-size: 28px 38 | } 39 | 40 | .markdown h3 { 41 | font-size: 22px 42 | } 43 | 44 | .markdown h4 { 45 | font-size: 18px 46 | } 47 | 48 | .markdown h5 { 49 | font-size: 14px 50 | } 51 | 52 | .markdown h6 { 53 | font-size: 14px 54 | } 55 | 56 | .markdown table { 57 | border-collapse: collapse; 58 | border-spacing: 0; 59 | display: block; 60 | overflow: auto; 61 | width: 100%; 62 | margin: 0 0 9px; 63 | } 64 | 65 | .markdown table th { 66 | font-weight: 700 67 | } 68 | 69 | .markdown table th, 70 | .markdown table td { 71 | border: 1px solid #DDD; 72 | padding: 6px 13px; 73 | } 74 | 75 | .markdown table tr { 76 | background-color: #FFF; 77 | border-top: 1px solid #CCC; 78 | } 79 | 80 | .markdown table tr:nth-child(2n) { 81 | background-color: #F8F8F8 82 | } 83 | 84 | .markdown li { 85 | line-height: 1.6; 86 | margin-top: 6px; 87 | } 88 | 89 | .markdown dl dt { 90 | font-style: italic; 91 | margin-top: 9px; 92 | } 93 | 94 | .markdown dl dd { 95 | margin: 0 0 9px; 96 | padding: 0 9px; 97 | } 98 | 99 | .markdown blockquote, 100 | .markdown blockquote p { 101 | font-size: 14px; 102 | background-color: #f5f5f5; 103 | } 104 | 105 | .markdown > pre { 106 | line-height: 1.6; 107 | overflow: auto; 108 | background: #fff; 109 | padding: 6px 10px; 110 | border: 1px solid #ddd; 111 | } 112 | 113 | .markdown > pre.linenums { 114 | padding: 0; 115 | } 116 | 117 | .markdown > pre > ol.linenums { 118 | -webkit-box-shadow: inset 40px 0 0 #f5f5f5, inset 41px 0 0 #ccc; 119 | box-shadow: inset 40px 0 0 #f5f5f5, inset 41px 0 0 #ccc; 120 | } 121 | 122 | .markdown > pre > code, 123 | .markdown > pre > ol.linenums > li > code { 124 | white-space: pre; 125 | word-wrap: normal; 126 | } 127 | 128 | .markdown > pre > ol.linenums > li > code { 129 | padding: 0 10px; 130 | } 131 | 132 | .markdown > pre > ol.linenums > li:first-child { 133 | padding-top: 6px; 134 | } 135 | 136 | .markdown > pre > ol.linenums > li:last-child { 137 | padding-bottom: 6px; 138 | } 139 | 140 | .markdown > pre > ol.linenums > li { 141 | border-left: 1px solid #ddd; 142 | } 143 | 144 | .markdown hr { 145 | border: none; 146 | color: #ccc; 147 | height: 4px; 148 | padding: 0; 149 | margin: 15px 0; 150 | background: transparent url('/static/img/hr.png') repeat-x 0 0; 151 | } 152 | 153 | .markdown blockquote:last-child, 154 | .markdown ul:last-child, 155 | .markdown ol:last-child, 156 | .markdown > pre:last-child, 157 | .markdown > pre:last-child, 158 | .markdown p:last-child { 159 | margin-bottom: 0; 160 | } 161 | 162 | .markdown .btn { 163 | color: #fff; 164 | } -------------------------------------------------------------------------------- /static_source/css/prettify.css: -------------------------------------------------------------------------------- 1 | /* Author: jmblog */ 2 | /* Project: https://github.com/jmblog/color-themes-for-google-code-prettify */ 3 | /* GitHub Theme */ 4 | /* Pretty printing styles. Used with prettify.js. */ 5 | /* SPAN elements with the classes below are added by prettyprint. */ 6 | /* plain text */ 7 | .pln { 8 | color: #333333; 9 | } 10 | 11 | @media screen { 12 | /* string content */ 13 | .str { 14 | color: #dd1144; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #333333; 20 | } 21 | 22 | /* a comment */ 23 | .com { 24 | color: #999988; 25 | } 26 | 27 | /* a type name */ 28 | .typ { 29 | color: #445588; 30 | } 31 | 32 | /* a literal value */ 33 | .lit { 34 | color: #445588; 35 | } 36 | 37 | /* punctuation */ 38 | .pun { 39 | color: #333333; 40 | } 41 | 42 | /* lisp open bracket */ 43 | .opn { 44 | color: #333333; 45 | } 46 | 47 | /* lisp close bracket */ 48 | .clo { 49 | color: #333333; 50 | } 51 | 52 | /* a markup tag name */ 53 | .tag { 54 | color: navy; 55 | } 56 | 57 | /* a markup attribute name */ 58 | .atn { 59 | color: teal; 60 | } 61 | 62 | /* a markup attribute value */ 63 | .atv { 64 | color: #dd1144; 65 | } 66 | 67 | /* a declaration */ 68 | .dec { 69 | color: #333333; 70 | } 71 | 72 | /* a variable name */ 73 | .var { 74 | color: teal; 75 | } 76 | 77 | /* a function name */ 78 | .fun { 79 | color: #990000; 80 | } 81 | } 82 | /* Use higher contrast and text-weight for printable form. */ 83 | @media print, projection { 84 | .str { 85 | color: #006600; 86 | } 87 | 88 | .kwd { 89 | color: #006; 90 | font-weight: bold; 91 | } 92 | 93 | .com { 94 | color: #600; 95 | font-style: italic; 96 | } 97 | 98 | .typ { 99 | color: #404; 100 | font-weight: bold; 101 | } 102 | 103 | .lit { 104 | color: #004444; 105 | } 106 | 107 | .pun, .opn, .clo { 108 | color: #444400; 109 | } 110 | 111 | .tag { 112 | color: #006; 113 | font-weight: bold; 114 | } 115 | 116 | .atn { 117 | color: #440044; 118 | } 119 | 120 | .atv { 121 | color: #006600; 122 | } 123 | } 124 | 125 | /* Specify class=linenums on a pre to get line numbering */ 126 | ol.linenums { 127 | margin-top: 0; 128 | margin-bottom: 0; 129 | } 130 | 131 | /* IE indents via margin-left */ 132 | li.L0, 133 | li.L1, 134 | li.L2, 135 | li.L3, 136 | li.L4, 137 | li.L5, 138 | li.L6, 139 | li.L7, 140 | li.L8, 141 | li.L9 { 142 | /* */ 143 | } 144 | 145 | /* Alternate shading for lines */ 146 | li.L1, 147 | li.L3, 148 | li.L5, 149 | li.L7, 150 | li.L9 { 151 | /* */ 152 | } -------------------------------------------------------------------------------- /static_source/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 |
25 | 43 |
44 |
45 |
46 |
47 |
48 |
49 | Beego Framework 50 |
51 |
52 | 一个使用 Go 的思维来帮助您构建并开发 Go 应用程序的开源框架 53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |

Quick start

64 |
65 |
package main
 66 | 
 67 | import "github.com/astaxie/beego"
 68 | 
 69 | func main() {
 70 |     beego.Run()
 71 | }
72 |
go build hello.go
 73 | ./hello
74 |
75 |
76 |
77 |
78 |

Features

79 |
    80 |
  • RESTFul support
  • 81 |
  • MVC architecture
  • 82 |
  • Session support (store in memory, file, Redis or MySQL)
  • 83 |
  • Cache support (store in memory, Redis or Memcache)
  • 84 |
  • Global Config
  • 85 |
  • Intelligent routing
  • 86 |
  • Thread-safe map
  • 87 |
  • Friendly displaying of errors
  • 88 |
  • Useful template functions
  • 89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | 102 | 103 | -------------------------------------------------------------------------------- /static_source/js/admin.js: -------------------------------------------------------------------------------- 1 | (function($){ 2 | 3 | $(function(){ 4 | $('[rel=select2-admin-model]').each(function(_,e){ 5 | var $e = $(e); 6 | var model = $e.data('model'); 7 | $e.select2({ 8 | minimumInputLength: 3, 9 | ajax: { 10 | url: '/admin/model/select', 11 | type: 'POST', 12 | data: function (query, page) { 13 | return { 14 | 'search': query, 15 | 'model': model 16 | }; 17 | }, 18 | results: function(d){ 19 | var results = []; 20 | if(d.success && d.data){ 21 | var data = d.data; 22 | $.each(data, function(i,v){ 23 | results.push({ 24 | 'id': v[0], 25 | 'text': v[1] 26 | }); 27 | }); 28 | } 29 | return {'results': results}; 30 | } 31 | }, 32 | initSelection: function(elm, cbk){ 33 | var id = parseInt($e.val(), 10); 34 | if(id){ 35 | $.post('/admin/model/get', {'id': id, 'model': model}, function(d){ 36 | if(d.success){ 37 | if(d.data && d.data.length){ 38 | cbk({ 39 | 'id': d.data[0], 40 | 'text': d.data[1] 41 | }); 42 | } 43 | } 44 | }); 45 | } 46 | } 47 | }); 48 | }); 49 | }); 50 | 51 | })(jQuery); -------------------------------------------------------------------------------- /static_source/js/html5shiv.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f); 8 | if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;dt;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){var t=document.documentElement,n=function(){};t.addEventListener?n=function(e,t,n){e.addEventListener(t,n,!1)}:t.attachEvent&&(n=function(t,n,i){t[n+i]=i.handleEvent?function(){var t=e.event;t.target=t.target||t.srcElement,i.handleEvent.call(i,t)}:function(){var n=e.event;n.target=n.target||n.srcElement,i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var i=function(){};t.removeEventListener?i=function(e,t,n){e.removeEventListener(t,n,!1)}:t.detachEvent&&(i=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var r={bind:n,unbind:i};"function"==typeof define&&define.amd?define("eventie/eventie",r):e.eventie=r}(this),function(e){function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){return"[object Array]"===a.call(e)}function i(e){var t=[];if(n(e))t=e;else if("number"==typeof e.length)for(var i=0,r=e.length;r>i;i++)t.push(e[i]);else t.push(e);return t}function r(e,n){function r(e,n,s){if(!(this instanceof r))return new r(e,n);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=i(e),this.options=t({},this.options),"function"==typeof n?s=n:t(this.options,n),s&&this.on("always",s),this.getImages(),o&&(this.jqDeferred=new o.Deferred);var c=this;setTimeout(function(){c.check()})}function a(e){this.img=e}function f(e){this.src=e,h[e]=this}r.prototype=new e,r.prototype.options={},r.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},r.prototype.addImage=function(e){var t=new a(e);this.images.push(t)},r.prototype.check=function(){function e(e,r){return t.options.debug&&c&&s.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},r.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify(t,e)})},r.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},o&&(o.fn.imagesLoaded=function(e,t){var n=new r(this,e,t);return n.jqDeferred.promise(o(this))}),a.prototype=new e,a.prototype.check=function(){var e=h[this.img.src]||new f(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},a.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var h={};return f.prototype=new e,f.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},f.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},f.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},f.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},f.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},f.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},r}var o=e.jQuery,s=e.console,c=s!==void 0,a=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],r):e.imagesLoaded=r(e.EventEmitter,e.eventie)}(window); -------------------------------------------------------------------------------- /static_source/js/jRespond.min.js: -------------------------------------------------------------------------------- 1 | /*! jRespond.js v 0.10 | Author: Jeremy Fields [jeremy.fields@viget.com], 2013 | License: MIT */ 2 | !function(a,b,c){"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=c:(a[b]=c,"function"==typeof define&&define.amd&&define(b,[],function(){return c}))}(this,"jRespond",function(a,b,c){"use strict";return function(a){var b=[],d=[],e=a,f="",g="",i=0,j=100,k=500,l=k,m=function(){var a=0;return a="number"!=typeof window.innerWidth?0!==document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth:window.innerWidth},n=function(a){if(a.length===c)o(a);else for(var b=0;b=e[c].enter&&a<=e[c].exit){b=!0;break}b&&f!==e[c].label?(g=f,f=e[c].label,p()):b||""===f||(f="",p())},r=function(a){if("object"==typeof a){if(a.join().indexOf(f)>=0)return!0}else{if("*"===a)return!0;if("string"==typeof a&&f===a)return!0}},s=function(){var a=m();a!==i?(l=j,q(a)):l=k,i=a,setTimeout(s,l)};return s(),{addFunc:function(a){n(a)},getBreakpoint:function(){return f}}}}(this,this.document)); -------------------------------------------------------------------------------- /static_source/js/jquery.clingify.min.js: -------------------------------------------------------------------------------- 1 | ;(function($,window,document,undefined){var pluginName="clingify",defaults={breakpoint:0,extraClass:"",throttle:100,detached:$.noop,locked:$.noop,resized:$.noop},wrapperClass="js-clingify-wrapper",lockedClass="js-clingify-locked",placeholderClass="js-clingify-placeholder",$buildPlaceholder=$("
").addClass(placeholderClass),$buildWrapper=$("
").addClass(wrapperClass),$window=$(window);function Plugin(element,options){this.element=element;this.$element=$(element);this.options=$.extend({},defaults, 2 | options);this._defaults=defaults;this._name=pluginName;this.vars={elemHeight:this.$element.height()};this.init()}Plugin.prototype={init:function(){var cling=this,scrollTimeout,throttle=cling.options.throttle,extraClass=cling.options.extraClass;cling.$element.wrap($buildPlaceholder.height(cling.vars.elemHeight)).wrap($buildWrapper);if(extraClass!==""&&typeof extraClass==="string"){cling.findWrapper().addClass(extraClass);cling.findPlaceholder().addClass(extraClass)}$window.on("scroll resize",function(event){if(!scrollTimeout)scrollTimeout= 3 | setTimeout(function(){if(event.type==="resize"&&typeof cling.options.resized==="function")cling.options.resized();cling.checkElemStatus();scrollTimeout=null},throttle)})},checkCoords:function(){var coords={windowWidth:$window.width(),windowOffset:$window.scrollTop(),placeholderOffset:this.findPlaceholder().offset().top};return coords},detachElem:function(){if(typeof this.options.detached==="function")this.options.detached();this.findWrapper().removeClass(lockedClass)},lockElem:function(){if(typeof this.options.locked=== 4 | "function")this.options.locked();this.findWrapper().addClass(lockedClass)},findPlaceholder:function(){return this.$element.closest("."+placeholderClass)},findWrapper:function(){return this.$element.closest("."+wrapperClass)},checkElemStatus:function(){var cling=this,currentCoords=cling.checkCoords(),isScrolledPast=function(){if(currentCoords.windowOffset>=currentCoords.placeholderOffset)return true;else return false},isWideEnough=function(){if(currentCoords.windowWidth>=cling.options.breakpoint)return true; 5 | else return false};if(isScrolledPast()&&isWideEnough())cling.lockElem();else if(!isScrolledPast()||!isWideEnough())cling.detachElem()}};$.fn[pluginName]=function(options){return this.each(function(){if(!$.data(this,"plugin_"+pluginName))$.data(this,"plugin_"+pluginName,new Plugin(this,options))})}})(jQuery,window,document); -------------------------------------------------------------------------------- /static_source/js/jquery.extend.js: -------------------------------------------------------------------------------- 1 | (function($){ 2 | 3 | (function(){ 4 | 5 | // extend jQuery ajax, set xsrf token value 6 | var ajax = $.ajax; 7 | $.extend({ 8 | ajax: function(url, options) { 9 | if (typeof url === 'object') { 10 | options = url; 11 | url = undefined; 12 | } 13 | options = options || {}; 14 | url = options.url; 15 | var xsrftoken = $('meta[name=_xsrf]').attr('content'); 16 | var oncetoken = $('[name=_once]').filter(':last').val(); 17 | var headers = options.headers || {}; 18 | var domain = document.domain.replace(/\./ig, '\\.'); 19 | if (!/^(http:|https:).*/.test(url) || eval('/^(http:|https:)\\/\\/(.+\\.)*' + domain + '.*/').test(url)) { 20 | headers = $.extend(headers, {'X-Xsrftoken':xsrftoken, 'X-Form-Once':oncetoken}); 21 | } 22 | options.headers = headers; 23 | var callback = options.success; 24 | options.success = function(data){ 25 | if(data.once){ 26 | // change all _once value if ajax data.once exist 27 | $('[name=_once]').val(data.once); 28 | } 29 | if(callback){ 30 | callback.apply(this, arguments); 31 | } 32 | }; 33 | return ajax(url, options); 34 | } 35 | }); 36 | 37 | })(); 38 | })(jQuery); -------------------------------------------------------------------------------- /static_source/js/jquery.jpanelmenu.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * jPanelMenu 1.3.0 (http://jpanelmenu.com) 4 | * By Anthony Colangelo (http://acolangelo.com) 5 | * 6 | * */ 7 | (function(e){e.jPanelMenu=function(t){if(typeof t=="undefined"||t==null)t={};var n={options:e.extend({menu:"#menu",trigger:".menu-trigger",excludedPanelContent:"style, script",direction:"left",openPosition:"250px",animated:!0,closeOnContentClick:!0,keyboardShortcuts:[{code:27,open:!1,close:!0},{code:37,open:!1,close:!0},{code:39,open:!0,close:!0},{code:77,open:!0,close:!0}],duration:150,openDuration:t.duration||150,closeDuration:t.duration||150,easing:"ease-in-out",openEasing:t.easing||"ease-in-out",closeEasing:t.easing||"ease-in-out",before:function(){},beforeOpen:function(){},beforeClose:function(){},after:function(){},afterOpen:function(){},afterClose:function(){},beforeOn:function(){},afterOn:function(){},beforeOff:function(){},afterOff:function(){}},t),settings:{transitionsSupported:"WebkitTransition"in document.body.style||"MozTransition"in document.body.style||"msTransition"in document.body.style||"OTransition"in document.body.style||"Transition"in document.body.style,shiftFixedChildren:!1,panelPosition:"relative",positionUnits:"px"},menu:"#jPanelMenu-menu",panel:".jPanelMenu-panel",fixedChildren:[],timeouts:{},clearTimeouts:function(){clearTimeout(n.timeouts.open);clearTimeout(n.timeouts.afterOpen);clearTimeout(n.timeouts.afterClose)},setPositionUnits:function(){var e=!1,t=["%","px","em"];for(unitID in t){var r=t[unitID];if(n.options.openPosition.toString().substr(-r.length)==r){e=!0;n.settings.positionUnits=r}}e||(n.options.openPosition=parseInt(n.options.openPosition)+n.settings.positionUnits)},checkFixedChildren:function(){n.disableTransitions();var t={position:e(n.panel).css("position")};t[n.options.direction]=e(n.panel).css(n.options.direction)=="auto"?0:e(n.panel).css(n.options.direction);e(n.panel).find("> *").each(function(){e(this).css("position")=="fixed"&&e(this).css(n.options.direction)=="auto"&&n.fixedChildren.push(this)});if(n.fixedChildren.length>0){var r={position:"relative"};r[n.options.direction]="1px";n.setPanelStyle(r);parseInt(e(n.fixedChildren[0]).offset().left)==0&&(n.settings.shiftFixedChildren=!0)}n.setPanelStyle(t)},setjPanelMenuStyles:function(){var t="#fff",r=e("html").css("background-color"),i=e("body").css("background-color");i!="transparent"&&i!="rgba(0, 0, 0, 0)"?t=i:r!="transparent"&&r!="rgba(0, 0, 0, 0)"?t=r:t="#fff";e("#jPanelMenu-style-master").length==0&&e("body").append('")},setMenuState:function(t){var n=t?"open":"closed";e("body").attr("data-menu-position",n)},getMenuState:function(){return e("body").attr("data-menu-position")},menuIsOpen:function(){return n.getMenuState()=="open"?!0:!1},setMenuStyle:function(t){e(n.menu).css(t)},setPanelStyle:function(t){e(n.panel).css(t)},showMenu:function(){n.setMenuStyle({display:"block"});n.setMenuStyle({"z-index":"1"})},hideMenu:function(){n.setMenuStyle({"z-index":"-1"});n.setMenuStyle({display:"none"})},enableTransitions:function(t,r){var i=t/1e3,s=n.getCSSEasingFunction(r);n.disableTransitions();e("body").append('")},disableTransitions:function(){e("#jPanelMenu-style-transitions").remove()},enableFixedTransitions:function(t,r,i,s){var o=i/1e3,u=n.getCSSEasingFunction(s);n.disableFixedTransitions(r);e("body").append('")},disableFixedTransitions:function(t){e("#jPanelMenu-style-fixed-"+t).remove()},getCSSEasingFunction:function(e){switch(e){case"linear":return e;case"ease":return e;case"ease-in":return e;case"ease-out":return e;case"ease-in-out":return e;default:return"ease-in-out"}},getJSEasingFunction:function(e){switch(e){case"linear":return e;default:return"swing"}},openMenu:function(t){if(typeof t=="undefined"||t==null)t=n.options.animated;n.clearTimeouts();n.options.before();n.options.beforeOpen();n.setMenuState(!0);n.setPanelStyle({position:"relative"});n.showMenu();var r={none:t?!1:!0,transitions:t&&n.settings.transitionsSupported?!0:!1};if(r.transitions||r.none){r.none&&n.disableTransitions();r.transitions&&n.enableTransitions(n.options.openDuration,n.options.openEasing);var i={};i[n.options.direction]=n.options.openPosition;n.setPanelStyle(i);n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t=e(this).prop("tagName").toLowerCase()+" "+e(this).attr("class"),i=t.replace(" ","."),t=t.replace(" ","-");r.none&&n.disableFixedTransitions(t);r.transitions&&n.enableFixedTransitions(i,t,n.options.openDuration,n.options.openEasing);var s={};s[n.options.direction]=n.options.openPosition;e(this).css(s)});n.timeouts.afterOpen=setTimeout(function(){n.disableTransitions();n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t=e(this).prop("tagName").toLowerCase()+" "+e(this).attr("class"),t=t.replace(" ","-");n.disableFixedTransitions(t)});n.options.after();n.options.afterOpen();n.initiateContentClickListeners()},n.options.openDuration)}else{var s=n.getJSEasingFunction(n.options.openEasing),o={};o[n.options.direction]=n.options.openPosition;e(n.panel).stop().animate(o,n.options.openDuration,s,function(){n.options.after();n.options.afterOpen();n.initiateContentClickListeners()});n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t={};t[n.options.direction]=n.options.openPosition;e(this).stop().animate(t,n.options.openDuration,s)})}},closeMenu:function(t){if(typeof t=="undefined"||t==null)t=n.options.animated;n.clearTimeouts();n.options.before();n.options.beforeClose();n.setMenuState(!1);var r={none:t?!1:!0,transitions:t&&n.settings.transitionsSupported?!0:!1};if(r.transitions||r.none){r.none&&n.disableTransitions();r.transitions&&n.enableTransitions(n.options.closeDuration,n.options.closeEasing);var i={};i[n.options.direction]=0+n.settings.positionUnits;n.setPanelStyle(i);n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t=e(this).prop("tagName").toLowerCase()+" "+e(this).attr("class"),i=t.replace(" ","."),t=t.replace(" ","-");r.none&&n.disableFixedTransitions(t);r.transitions&&n.enableFixedTransitions(i,t,n.options.closeDuration,n.options.closeEasing);var s={};s[n.options.direction]=0+n.settings.positionUnits;e(this).css(s)});n.timeouts.afterClose=setTimeout(function(){n.setPanelStyle({position:n.settings.panelPosition});n.disableTransitions();n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t=e(this).prop("tagName").toLowerCase()+" "+e(this).attr("class"),t=t.replace(" ","-");n.disableFixedTransitions(t)});n.hideMenu();n.options.after();n.options.afterClose();n.destroyContentClickListeners()},n.options.closeDuration)}else{var s=n.getJSEasingFunction(n.options.closeEasing),o={};o[n.options.direction]=0+n.settings.positionUnits;e(n.panel).stop().animate(o,n.options.closeDuration,s,function(){n.setPanelStyle({position:n.settings.panelPosition});n.hideMenu();n.options.after();n.options.afterClose();n.destroyContentClickListeners()});n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t={};t[n.options.direction]=0+n.settings.positionUnits;e(this).stop().animate(t,n.options.closeDuration,s)})}},triggerMenu:function(e){n.menuIsOpen()?n.closeMenu(e):n.openMenu(e)},initiateClickListeners:function(){e(document).on("click",n.options.trigger,function(){n.triggerMenu(n.options.animated);return!1})},destroyClickListeners:function(){e(document).off("click",n.options.trigger,null)},initiateContentClickListeners:function(){if(!n.options.closeOnContentClick)return!1;e(document).on("click",n.panel,function(e){n.menuIsOpen()&&n.closeMenu(n.options.animated)});e(document).on("touchend",n.panel,function(e){n.menuIsOpen()&&n.closeMenu(n.options.animated)})},destroyContentClickListeners:function(){if(!n.options.closeOnContentClick)return!1;e(document).off("click",n.panel,null);e(document).off("touchend",n.panel,null)},initiateKeyboardListeners:function(){var t=["input","textarea"];e(document).on("keydown",function(r){var i=e(r.target),s=!1;e.each(t,function(){i.is(this.toString())&&(s=!0)});if(s)return!0;for(mapping in n.options.keyboardShortcuts)if(r.which==n.options.keyboardShortcuts[mapping].code){var o=n.options.keyboardShortcuts[mapping];o.open&&o.close?n.triggerMenu(n.options.animated):o.open&&!o.close&&!n.menuIsOpen()?n.openMenu(n.options.animated):!o.open&&o.close&&n.menuIsOpen()&&n.closeMenu(n.options.animated);return!1}})},destroyKeyboardListeners:function(){e(document).off("keydown",null)},setupMarkup:function(){e("html").addClass("jPanelMenu");e("body > *").not(n.menu+", "+n.options.excludedPanelContent).wrapAll('
');e(n.options.menu).clone().attr("id",n.menu.replace("#","")).insertAfter("body > "+n.panel)},resetMarkup:function(){e("html").removeClass("jPanelMenu");e("body > "+n.panel+" > *").unwrap();e(n.menu).remove()},init:function(){n.options.beforeOn();n.initiateClickListeners();Object.prototype.toString.call(n.options.keyboardShortcuts)==="[object Array]"&&n.initiateKeyboardListeners();n.setjPanelMenuStyles();n.setMenuState(!1);n.setupMarkup();n.setMenuStyle({width:n.options.openPosition});n.checkFixedChildren();n.setPositionUnits();n.closeMenu(!1);n.options.afterOn()},destroy:function(){n.options.beforeOff();n.closeMenu();n.destroyClickListeners();Object.prototype.toString.call(n.options.keyboardShortcuts)==="[object Array]"&&n.destroyKeyboardListeners();n.resetMarkup();var t={};t[n.options.direction]="auto";e(n.fixedChildren).each(function(){e(this).css(t)});n.fixedChildren=[];n.options.afterOff()}};return{on:n.init,off:n.destroy,trigger:n.triggerMenu,open:n.openMenu,close:n.closeMenu,isOpen:n.menuIsOpen,menu:n.menu,getMenu:function(){return e(n.menu)},panel:n.panel,getPanel:function(){return e(n.panel)}}}})(jQuery); -------------------------------------------------------------------------------- /static_source/js/main.js: -------------------------------------------------------------------------------- 1 | (function($){ 2 | 3 | // Avoid embed thie site in an iframe of other WebSite 4 | if (top.location != location) { 5 | top.location.href = location.href; 6 | } 7 | 8 | // btn checked box toggle 9 | $(document).on('click', '.btn-checked', function(){ 10 | var $e = $(this); 11 | var $i = $e.siblings('[name='+$e.data('name')+']'); 12 | if($e.hasClass('active')) { 13 | $i.val('true'); 14 | } else { 15 | $i.val('false'); 16 | } 17 | $e.blur(); 18 | }); 19 | 20 | // change locale and reload page 21 | $(document).on('click', '.lang-changed', function(){ 22 | var $e = $(this); 23 | var lang = $e.data('lang'); 24 | $.cookie('lang', lang, {path: '/', expires: 365}); 25 | window.location.reload(); 26 | }); 27 | 28 | (function(){ 29 | var v = $.cookie('JsStorage'); 30 | if(v){ 31 | var values = v.split(':::'); 32 | if(values.length > 1){ 33 | $.jStorage[values[0]].apply(this, values.splice(1)); 34 | } 35 | $.removeCookie('JsStorage', {path: '/'}); 36 | } 37 | })(); 38 | 39 | (function(){ 40 | 41 | $.fn.mdFilter = function(){ 42 | var $e = $(this); 43 | $e.find('img').each(function(_,img){ 44 | var $img = $(img); 45 | $img.addClass('img-responsive'); 46 | }); 47 | 48 | var $pre = $e.find('pre > code').parent(); 49 | $pre.addClass("prettyprint"); 50 | prettyPrint(); 51 | }; 52 | 53 | })(); 54 | 55 | (function(){ 56 | 57 | var caches = {}; 58 | $.fn.showGithub = function(user, repo, type, count){ 59 | 60 | $(this).each(function(){ 61 | var $e = $(this); 62 | 63 | var user = $e.data('user') || user, 64 | repo = $e.data('repo') || repo, 65 | type = $e.data('type') || type || 'watch', 66 | count = $e.data('count') == 'true' || count || true; 67 | 68 | var $mainButton = $e.html(' ').find('.github-btn'), 69 | $button = $mainButton.find('.btn'), 70 | $text = $mainButton.find('.gh-text'), 71 | $counter = $mainButton.find('.gh-count'); 72 | 73 | function addCommas(a) { 74 | return String(a).replace(/(\d)(?=(\d{3})+$)/g, '$1,'); 75 | } 76 | 77 | function callback(a) { 78 | if (type == 'watch') { 79 | $counter.html(addCommas(a.watchers)); 80 | } else { 81 | if (type == 'fork') { 82 | $counter.html(addCommas(a.forks)); 83 | } else { 84 | if (type == 'follow') { 85 | $counter.html(addCommas(a.followers)); 86 | } 87 | } 88 | } 89 | 90 | if (count) { 91 | $counter.css('display', 'inline-block'); 92 | } 93 | } 94 | 95 | function jsonp(url) { 96 | var ctx = caches[url] || {}; 97 | caches[url] = ctx; 98 | if(ctx.onload || ctx.data){ 99 | if(ctx.data){ 100 | callback(ctx.data); 101 | } else { 102 | setTimeout(jsonp, 500, url); 103 | } 104 | }else{ 105 | ctx.onload = true; 106 | $.getJSON(url, function(a){ 107 | ctx.onload = false; 108 | ctx.data = a; 109 | callback(a); 110 | }); 111 | } 112 | } 113 | 114 | var urlBase = 'https://github.com/' + user + '/' + repo; 115 | 116 | $button.attr('href', urlBase + '/'); 117 | 118 | if (type == 'watch') { 119 | $mainButton.addClass('github-watchers'); 120 | $text.html('Star'); 121 | $counter.attr('href', urlBase + '/stargazers'); 122 | } else { 123 | if (type == 'fork') { 124 | $mainButton.addClass('github-forks'); 125 | $text.html('Fork'); 126 | $counter.attr('href', urlBase + '/network'); 127 | } else { 128 | if (type == 'follow') { 129 | $mainButton.addClass('github-me'); 130 | $text.html('Follow @' + user); 131 | $button.attr('href', 'https://github.com/' + user); 132 | $counter.attr('href', 'https://github.com/' + user + '/followers'); 133 | } 134 | } 135 | } 136 | 137 | if (type == 'follow') { 138 | jsonp('https://api.github.com/users/' + user); 139 | } else { 140 | jsonp('https://api.github.com/repos/' + user + '/' + repo); 141 | } 142 | 143 | }); 144 | }; 145 | 146 | })(); 147 | 148 | 149 | $(function(){ 150 | // Encode url. 151 | var $doc = $('.docs-markdown'); 152 | $doc.find('a').each(function () { 153 | var node = $(this); 154 | var link = node.attr('href'); 155 | var index = link.indexOf('#'); 156 | if (link.indexOf('http') === 0 && link.indexOf(window.location.hostname) == -1) { 157 | return; 158 | } 159 | if (index < 0 || index + 1 > link.length) { 160 | return; 161 | } 162 | var val = link.substring(index + 1, link.length); 163 | val = encodeURIComponent(decodeURIComponent(val).toLowerCase().replace(/\s+/g, '-')); 164 | node.attr('href', link.substring(0, index) + '#' + val); 165 | }); 166 | 167 | // Set anchor. 168 | $doc.find('h1, h2, h3, h4, h5, h6').each(function () { 169 | var node = $(this); 170 | if (node.hasClass('ui')) { 171 | return; 172 | } 173 | var val = encodeURIComponent(node.text().toLowerCase().replace(/\s+/g, "-")); 174 | node = node.wrap('
'); 175 | node.append(''); 176 | }); 177 | }); 178 | 179 | $(function(){ 180 | // on dom ready 181 | 182 | $('[data-show=tooltip]').each(function(k, e){ 183 | var $e = $(e); 184 | $e.tooltip({placement: $e.data('placement'), title: $e.data('tooltip-text')}); 185 | $e.tooltip('show'); 186 | }); 187 | 188 | $('[rel=select2]').select2(); 189 | 190 | $('.markdown').mdFilter(); 191 | 192 | $('[rel=show-github]').showGithub(); 193 | 194 | if($.jPanelMenu && $('[data-toggle=jpanel-menu]').size() > 0) { 195 | var jpanelMenuTrigger = $('[data-toggle=jpanel-menu]'); 196 | 197 | var jPM = $.jPanelMenu({ 198 | animated: false, 199 | menu: jpanelMenuTrigger.data('target'), 200 | direction: 'left', 201 | trigger: '.'+ jpanelMenuTrigger.attr('class'), 202 | excludedPanelContent: '.jpanel-menu-exclude', 203 | openPosition: '180px', 204 | afterOpen: function() { 205 | jpanelMenuTrigger.addClass('open'); 206 | $('html').addClass('jpanel-menu-open'); 207 | }, 208 | afterClose: function() { 209 | jpanelMenuTrigger.removeClass('open'); 210 | $('html').removeClass('jpanel-menu-open'); 211 | } 212 | }); 213 | 214 | //jRespond settings 215 | var jRes = jRespond([{ 216 | label: 'small', 217 | enter: 0, 218 | exit: 1010 219 | }]); 220 | 221 | //turn jPanel Menu on/off as needed 222 | jRes.addFunc({ 223 | breakpoint: 'small', 224 | enter: function() { 225 | jPM.on(); 226 | }, 227 | exit: function() { 228 | jPM.off(); 229 | } 230 | }); 231 | } 232 | 233 | var $container = $('#products-showcase'); 234 | $container.imagesLoaded(function(){ 235 | $container.masonry({ 236 | itemSelector : '.product' 237 | }); 238 | }); 239 | 240 | }); 241 | 242 | })(jQuery); -------------------------------------------------------------------------------- /static_source/js/respond.min.js: -------------------------------------------------------------------------------- 1 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 2 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 3 | window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.documentElement,e=d.firstElementChild||d.firstChild,f=a.createElement("body"),g=a.createElement("div");return g.id="mq-test-1",g.style.cssText="position:absolute;top:-100em",f.style.background="none",f.appendChild(g),function(a){return g.innerHTML='­',d.insertBefore(f,e),c=42===g.offsetWidth,d.removeChild(f),{matches:c,media:a}}}(document); 4 | 5 | /*! Respond.js v1.3.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 6 | (function(a){"use strict";function x(){u(!0)}var b={};if(a.respond=b,b.update=function(){},b.mediaQueriesSupported=a.matchMedia&&a.matchMedia("only all").matches,!b.mediaQueriesSupported){var q,r,t,c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=c.getElementsByTagName("base")[0],l=j.getElementsByTagName("link"),m=[],n=function(){for(var b=0;l.length>b;b++){var c=l[b],d=c.href,e=c.media,f=c.rel&&"stylesheet"===c.rel.toLowerCase();d&&f&&!h[d]&&(c.styleSheet&&c.styleSheet.rawCssText?(p(c.styleSheet.rawCssText,d,e),h[d]=!0):(!/^([a-zA-Z:]*\/\/)/.test(d)&&!k||d.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&m.push({href:d,media:e}))}o()},o=function(){if(m.length){var b=m.shift();v(b.href,function(c){p(c,b.href,b.media),h[b.href]=!0,a.setTimeout(function(){o()},0)})}},p=function(a,b,c){var d=a.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),g=d&&d.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c;b.length&&(b+="/"),i&&(g=1);for(var j=0;g>j;j++){var k,l,m,n;i?(k=c,f.push(h(a))):(k=d[j].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&h(RegExp.$2))),m=k.split(","),n=m.length;for(var o=0;n>o;o++)l=m[o],e.push({media:l.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:f.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},s=function(){var a,b=c.createElement("div"),e=c.body,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",e||(e=f=c.createElement("body"),e.style.background="none"),e.appendChild(b),d.insertBefore(e,d.firstChild),a=b.offsetWidth,f?d.removeChild(e):e.removeChild(b),a=t=parseFloat(a)},u=function(b){var h="clientWidth",k=d[h],m="CSS1Compat"===c.compatMode&&k||c.body[h]||k,n={},o=l[l.length-1],p=(new Date).getTime();if(b&&q&&i>p-q)return a.clearTimeout(r),r=a.setTimeout(u,i),void 0;q=p;for(var v in e)if(e.hasOwnProperty(v)){var w=e[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?t||s():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?t||s():1)),w.hasquery&&(z&&A||!(z||m>=x)||!(A||y>=m))||(n[w.media]||(n[w.media]=[]),n[w.media].push(f[w.rules]))}for(var C in g)g.hasOwnProperty(C)&&g[C]&&g[C].parentNode===j&&j.removeChild(g[C]);for(var D in n)if(n.hasOwnProperty(D)){var E=c.createElement("style"),F=n[D].join("\n");E.type="text/css",E.media=D,j.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(c.createTextNode(F)),g.push(E)}},v=function(a,b){var c=w();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},w=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}();n(),b.update=n,a.addEventListener?a.addEventListener("resize",x,!1):a.attachEvent&&a.attachEvent("onresize",x)}})(this); 7 | -------------------------------------------------------------------------------- /views/about.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{.Title}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "body"}} 7 |
8 |
9 |
10 |
11 |
12 | 18 | {{.Data | str2html}} 19 |
20 |
21 |
22 |
23 |
24 | {{end}} 25 | -------------------------------------------------------------------------------- /views/base/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{template "base/head.html" .}} 5 | {{template "head" .}} 6 | 7 | 8 | 9 |
10 | {{template "base/navbar.html" .}} 11 |
12 | {{template "body" .}} 13 |
14 |
15 |
16 | {{template "base/footer.html" .}} 17 | 18 | -------------------------------------------------------------------------------- /views/base/disqus.html: -------------------------------------------------------------------------------- 1 |
2 | 13 | 14 | comments powered by Disqus -------------------------------------------------------------------------------- /views/base/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 37 |
38 |
39 | 40 | 50 | 51 | {{compress_js "lib"}} 52 | {{compress_js "app"}} 53 | -------------------------------------------------------------------------------- /views/base/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{template "meta" .}} 6 | 7 | 8 | 9 | {{compress_css "lib"}} 10 | {{str2html ""}} 13 | {{compress_css "app"}} 14 | 15 | {{str2html ""}} -------------------------------------------------------------------------------- /views/base/navbar.html: -------------------------------------------------------------------------------- 1 | 61 | -------------------------------------------------------------------------------- /views/blog.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{.Title}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "body"}} 7 |
8 |
9 |
10 |
11 |
12 | 17 | {{.Data | str2html}} 18 |
19 |
20 | {{template "base/disqus.html" .}} 21 |
22 |
23 |
24 | {{end}} -------------------------------------------------------------------------------- /views/community.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{i18n .Lang "community"}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "body"}} 7 |
8 |
9 |
10 |
11 |
12 | {{if eq .Lang "en-US"}} 13 | 19 | 20 |

Get in touch

21 |

22 | There are several ways to get in touch: 23 |

24 | 25 | 37 | 38 | 39 | 40 |

More options:

41 |
    42 |
  • Sina Weibo: @asta谢
  • 43 |
  • Beego developer QQ Group: 258969317(Be sure that you contributed before you ask to join)
  • 44 |
45 | 46 |

Share

47 |

48 | Sharing what you have built with beego is a great way to help people understand the value of beego. If you have a great story to tell we'll be happy to help you spread the word. 49 |

50 |
    51 |
  • Tell your story at a company tech talk, tweet (#beego, @beego) present at your local user group, or submit a 52 | talk proposal to a conference or event about how you are using beego.
  • 53 |
  • If you are using beego, in production, become a public reference.
  • 54 |
  • Write a tutorial.
  • 55 |
56 | 57 |

Contribute

58 |

59 | An Open Source project like beego couldn’t exist without contributions from the developer community. Until now, there are over 35 contributors and nearly 410 forks on the project. 60 |

61 |
    62 |
  • Take a look at our issues list and consider submitting a patch
  • 63 |
  • Review our roadmap on GitHub and provide feedback
  • 64 |
  • Consider contributing.
  • 65 |
66 |

67 | We run the documentation as an open source project. The sources are available from the main beedoc repository on Github, and we encourage you to make improvements, whether big or small, make a pull request. 68 |

69 | 70 |

What people have already built using beego

71 |

72 | Beego is a powerful framework for many different use cases. Here are some great early use cases for beego, as described by members of our community. 73 |

74 | {{.Data | str2html}} 75 | {{i18n .Lang "add use case"}} 76 | 77 | {{else if eq .Lang "zh-CN"}} 78 | 79 | 85 | 86 |

参与社区讨论

87 |

88 | 您可以通过以下方式参与社区讨论: 89 |

90 | 91 | 100 | 101 | 102 | 103 |

更多选择:

104 |
    105 |
  • Sina Weibo: @asta谢
  • 106 |
  • beego 开发者 QQ 群:523992905(验证需填入您的 Github 地址以确保您为 beego 贡献过代码)
  • 107 |
108 | 109 |

分享开发经验

110 |

111 | 分享您已经使用基于 beego 完成的惊人作品能够很好的帮助他人理解 beego 的价值。如果您有意愿分享 beego 的开发故事,我们将乐意为您广而告之。 112 |

113 |
    114 |
  • 公司内的技术分享,可以通过微博(#beego, @beego)来通知我们,或者也可以将您的建议或相关会议告知我们,让我们知道您是如何使用 beego 的。
  • 115 |
  • 如果您正在构建基于 beego 的实际应用,我们将非常乐意地为您传播。
  • 116 |
  • 您也可以写一个有关 beego 的开发教程。
  • 117 |
118 | 119 |

贡献社区代码

120 |

121 | 一个开源的项目是无法离开开发者社区成员的积极贡献的,到目前为止,已经有超过 35 位贡献者以及 400 多的项目派生。 122 |

123 |
    124 |
  • 如果您需要提交问题请通过 问题列表 来完成。
  • 125 |
  • 您可在 GitHub 上查看我们的发展路线,并给予反馈。
  • 126 |
  • 贡献代码,您值得考虑。
  • 127 |
128 |

129 | 我们将 API 文档 也作为一个开源项目来处理,您可以在 Github 的 项目仓库 中找到相关源码。我们鼓励您参与完善 Beego 的文档,不论改动大小,都欢迎您的补充与提交! 130 |

131 | 132 |

beego 开发实例展示

133 |

134 | Beego 是一个适于多种开发目标的强大的应用框架,这里有一份公开项目的清单,用于展示这些应用程序将 beego 用作何种开发。 135 |

136 | {{.Data | str2html}} 137 | {{i18n .Lang "add use case"}} 138 | 139 | {{end}} 140 | 141 | 142 |
143 |
144 |
145 |
146 |
147 | {{end}} 148 | -------------------------------------------------------------------------------- /views/docs.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{i18n .Lang .Title}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "docs"}} 7 | {{with .Doc}} 8 | {{range .Docs}} 9 |
    10 | {{if .Name}} 11 | {{ if .IsDir}} 12 |
  • 13 |
    14 | {{if .HasContent}} 15 | {{.Name}} 16 | {{else}} 17 | {{.Name}} 18 | {{end}} 19 |
    20 | {{template "docs" dict "root" $.root "Doc" .}} 21 |
  • 22 | {{else}} 23 |
  • {{.Name}}
  • 24 | {{end}} 25 | {{end}} 26 |
27 | {{end}} 28 | {{end}} 29 | {{end}} 30 | {{define "body"}} 31 |
32 |
33 |
34 | 42 |
43 |
44 |
45 |
46 | 58 | 59 |
60 |
61 |

62 | {{i18n .Lang "improve doc on github"}} 63 | 64 |

65 |
66 | {{.Data|str2html}} 67 |
68 |
69 |
70 | 73 | {{template "base/disqus.html" .}} 74 |
75 |
76 |
77 | {{end}} -------------------------------------------------------------------------------- /views/donate.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{.Title}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "body"}} 7 |
8 |
9 |
10 |
11 |
12 | 15 | {{.Data | str2html}} 16 |
17 |
18 |
19 |
20 |
21 | {{end}} -------------------------------------------------------------------------------- /views/home.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "meta"}} 3 | 4 | 5 | {{i18n .Lang "homepage"}} - beego: {{i18n .Lang "app_intro"}} 6 | {{end}} 7 | {{define "head"}}{{end}} 8 | {{define "body"}} 9 |
10 |
11 |
12 |
13 |
14 | Beego Framework 15 |
16 |
17 | {{i18n .Lang "home.beego_desc"}} 18 |
19 |
20 | {{i18n .Lang "learn more"}} 21 | {{i18n .Lang "get started"}} 22 | {{i18n .Lang "version"}} 23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |

{{i18n .Lang "home.quick_start"}}

32 |
33 |
34 |
35 | {{if eq .Lang "zh-CN"}} 36 |

下载安装

37 |
go get github.com/beego/beego/v2@v2.0.0
38 |

创建文件 hello.go

39 |
package main

import "github.com/beego/beego/v2/server/web"

func main() {
web.Run()
}
40 | {{else}} 41 |

Download and install

42 |
go get github.com/beego/beego/v2@v2.0.0
43 |

Create file hello.go

44 |
package main

import "github.com/beego/beego/v2/server/web"

func main() {
web.Run()
}
45 | {{end}} 46 |
47 |
48 |
49 |
50 | {{if eq .Lang "zh-CN"}} 51 |

编译运行

52 |
go build -o hello hello.go
./hello
53 |

浏览效果

54 |

打开浏览器并访问 http://localhost:8080

55 |

恭喜!您已经成功构建了第一个 beego 项目。

56 |

请查阅 开发文档 以进行深入学习。

57 | {{else}} 58 |

Build and run

59 |
go build hello.go
./hello
60 |

View effects

61 |

Open your browser and visit http://localhost:8080

62 |

Congratulations! You just built your first beego app.

63 |

Please see Documentation for going further.

64 | {{end}} 65 |
66 |
67 |
68 |
69 |
70 |
71 |

{{i18n .Lang "home.further_reading"}}

72 |
73 | 88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |

{{i18n .Lang "home.features"}}

97 |
98 |
99 |
100 |

101 | {{if eq .Lang "zh-CN"}} 102 | 简单化 103 | {{else}} 104 | EASY TO USE 105 | {{end}} 106 |

107 |

108 | {{if eq .Lang "zh-CN"}} 109 | RESTful 支持、MVC 模型,可以使用 bee 工具快速地开发应用,包括监控代码修改进行热编译、自动化测试代码以及自动化打包部署。 110 | {{else}} 111 | With RESTful support, MVC model, and use bee tool to build your apps quickly with features including code hot compile, automated testing, and automated packing and deploying. 112 | {{end}} 113 |

114 |
115 |
116 |
117 |
118 |

119 | {{if eq .Lang "zh-CN"}} 120 | 智能化 121 | {{else}} 122 | INTELLIGENT 123 | {{end}} 124 |

125 |

126 | {{if eq .Lang "zh-CN"}} 127 | 支持智能路由、智能监控,可以监控 QPS、内存消耗、CPU 使用,以及 goroutine 的运行状况,让您的线上应用尽在掌握。 128 | {{else}} 129 | With intelligent routing and monitoring, it's able to monitor your QPS, memory and CPU usages, and goroutine status. It provides you full control of your online apps. 130 | {{end}} 131 |

132 |
133 |
134 |
135 |
136 |

137 | {{if eq .Lang "zh-CN"}} 138 | 模块化 139 | {{else}} 140 | MODULAR 141 | {{end}} 142 |

143 |

144 | {{if eq .Lang "zh-CN"}} 145 | beego 内置了强大的模块,包括 Session、缓存操作、日志记录、配置解析、性能监控、上下文操作、ORM 模块、请求模拟等强大的模块,足以支撑你任何的应用。 146 | {{else}} 147 | With powerful built-in modules including session control, caching, logging, configuration parsing, performance supervising, context handling, ORM supporting, and requests simulating. You get the powerful foundation for any type of applications. 148 | {{end}} 149 |

150 |
151 |
152 |
153 |
154 |

155 | {{if eq .Lang "zh-CN"}} 156 | 高性能 157 | {{else}} 158 | HIGH PERFORMANCE 159 | {{end}} 160 |

161 |

162 | {{if eq .Lang "zh-CN"}} 163 | beego 采用了 Go 原生的 http 包来处理请求,goroutine 的并发效率足以应付大流量的 Web 应用和 API 应用,目前已经应用于大量高并发的产品中。 164 | {{else}} 165 | With native Go http package to handle the requests and the efficient concurrence of goroutine. Your beego applications can handle massive trafic as beego are doing in many productions. 166 | {{end}} 167 |

168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |

{{i18n .Lang "home.who_are_use"}}

178 |
179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 |
200 |
201 |
202 |
203 |
204 | 205 |
206 | {{end}} 207 | -------------------------------------------------------------------------------- /views/products.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{i18n .Lang "products_use_beego"}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "body"}} 7 |
8 |
9 |
10 |
11 |

{{i18n .Lang "products_use_beego"}}

12 |
13 | {{i18n .Lang "submit_your_product"}} 14 | {{if eq .Lang "zh-CN"}} 15 | ,如果使用GitHub有任何问题,你可以直接发送产品信息到邮箱 xiemengjun@gmail.com 16 | {{else}} 17 | . If you have any problem when use GitHub. You can direct send product info to mailbox: xiemengjun@gmail.com 18 | {{end}} 19 |
20 |
21 |
22 |
23 |
24 | {{range .Products.Projects}} 25 |
26 |
27 |

{{.Name}}

28 | {{if .Desc}} 29 |
30 | {{.Desc}} 31 |
32 | {{end}} 33 | {{if .Thumb}} 34 |
35 | 36 | 37 | 38 |
39 | {{end}} 40 |
41 | {{if .Src}}Open Source - {{end}}Web - {{.Date}} 42 | {{.Submitter}} 43 |
44 | 45 |
46 |
47 | {{end}} 48 |
49 |
50 | {{end}} -------------------------------------------------------------------------------- /views/quickstart.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{.Title}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "body"}} 7 |
8 |
9 |
10 |
11 |
12 | 18 | {{.Data | str2html}} 19 |
20 |
21 |
22 |
23 |
24 | {{end}} 25 | -------------------------------------------------------------------------------- /views/samples_en.html: -------------------------------------------------------------------------------- 1 | {{template "header_en" .}} 2 | beego - Simple & powerful Go App framework 3 | 4 | 5 | 6 | {{template "navbar_en" .}} 7 |
8 |
9 |
10 |
11 | 18 |
19 |
20 | 21 |
22 | 25 | 26 |
{{.Data | str2html}}
27 |
28 |
29 |
30 | {{template "footer_en" .}} 31 | 32 | -------------------------------------------------------------------------------- /views/team.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{.Title}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "body"}} 7 |
8 |
9 |
10 |
11 |
12 | 18 | {{.Data | str2html}} 19 |
20 |
21 |
22 |
23 |
24 | {{end}} 25 | -------------------------------------------------------------------------------- /views/tweets.html: -------------------------------------------------------------------------------- 1 |
2 |

{{i18n .Lang "tweets title"}}

3 |
4 |
5 | 6 |
7 | 8 |
9 | 10 |
11 | 12 |
13 |
14 |
15 | 16 | Fabrice Aneche 17 | 18 | 19 | @akhenakh 20 | 21 |

22 | Really interested in Beego web framework :) github.com/astaxie/beego/... 23 | 24 |

25 |
26 | 27 |
28 | 29 | Saulo Onze 30 | 31 | 32 | @sauloonze 33 | 34 |

35 | Beego is a lightweight, open source, non-blocking and scalable web framework for the Go programming language. github.com/astaxie/beego/... 36 | 37 |

38 |
39 | 40 |
41 | 42 | Jemes Hsu 43 | 44 | 45 | @jemeshsu 46 | 47 |

48 | Like this #golang web framework beego. Lightweight. github.com/astaxie/beego 49 | 50 |

51 |
52 | 53 |
54 | 55 | Rodrigo Moraes 56 | 57 | 58 | @Rodrigo Moraes 59 | 60 |

61 | If Gorilla was a framework, it would probably look like beego. :) #golang 62 | 63 |

64 |
65 | 66 |
67 | 68 | 69 | @独立游戏开发者sban 70 | 71 |

72 | beego是一个轻量兼强大的web开发框架,具有bee api功能,也可以创建无模板的接口型工具;此外,beego还实现了数据库连接等,是与revel比肩的go web开发框架。 73 | 74 |

75 |
76 | 77 |
78 | 79 | 80 | @天崖追梦人 81 | 82 |

83 | beego 框架很不错,该有的都有了,用它可以很快上手开发。最重要的是文档做的非常好,这个在国内的开源界内做的也是很突出的。 84 | 85 |

86 |
87 |
88 |
89 |
90 |
-------------------------------------------------------------------------------- /views/video.html: -------------------------------------------------------------------------------- 1 | {{template "base/base.html" .}} 2 | {{define "head"}}{{end}} 3 | {{define "meta"}} 4 | {{.Title}} - beego: {{i18n .Lang "app_intro"}} 5 | {{end}} 6 | {{define "body"}} 7 |
8 |
9 |
10 |
11 |
12 | 17 | {{.Data | str2html}} 18 |
19 |
20 |
21 |
22 |
23 | {{end}} 24 | --------------------------------------------------------------------------------