Skip to content

Commit

Permalink
迁移vote插件 #2053
Browse files Browse the repository at this point in the history
  • Loading branch information
twinh committed Dec 2, 2016
0 parents commit 165412f
Show file tree
Hide file tree
Showing 47 changed files with 2,460 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
language: php

php:
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- hhvm
- nightly

matrix:
fast_finish: true
allow_failures:
- php: hhvm
- php: nightly

services:
- memcached

cache:
directories:
- $HOME/.composer/cache
- node_modules

before_install:
- phpenv config-add tests/travis.ini
- nvm install node

install:
- composer install --no-interaction
- bash vendor/miaoxing/plugin/build/install-travis.sh

script:
- bash vendor/miaoxing/plugin/build/build-travis.sh --coverage 95

after_success:
- wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
- travis_retry php coveralls.phar -v --exclude-no-stmt
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 投票

[![Build Status](https://img.shields.io/travis/miaoxing/vote/master.svg?style=flat-square)](https://travis-ci.org/miaoxing/vote)
[![Coverage Status](https://img.shields.io/coveralls/miaoxing/vote.svg?style=flat-square)](https://coveralls.io/r/miaoxing/vote?branch=master)
[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://www.opensource.org/licenses/MIT)
23 changes: 23 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "miaoxing/vote",
"description": "Miaoxing Vote Plugin",
"keywords": [
"miaoxing", "vote"
],
"license": "MIT",
"require": {
"miaoxing/app": "dev-master@dev"
},
"autoload": {
"psr-4": {
"Miaoxing\\Vote\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"MiaoxingTest\\Vote\\": "tests"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
29 changes: 29 additions & 0 deletions docs/AutoComplete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Miaoxing\Vote\docs {
/**
* @property \Miaoxing\Vote\Service\Vote $vote 红包活动
* @method \Miaoxing\Vote\Service\Vote|\Miaoxing\Vote\Service\Vote[] vote()
*
* @property \Miaoxing\Vote\Service\VoteUser $voteUser 投票用户
* @method \Miaoxing\Vote\Service\VoteUser|\Miaoxing\Vote\Service\VoteUser[] voteUser()
*
* @property \Miaoxing\Vote\Service\VoteLog $voteLog 投票日志
* @method \Miaoxing\Vote\Service\VoteLog|\Miaoxing\Vote\Service\VoteLog[] voteLog()
*
* @property \Miaoxing\Vote\Service\VoteWork $voteWork 参赛作品
* @method \Miaoxing\Vote\Service\VoteWork|\Miaoxing\Vote\Service\VoteWork[] voteWork()
*/
class AutoComplete
{
}
}

namespace {
/**
* @return \Miaoxing\Vote\docs\AutoComplete
*/
function wei()
{
}
}
23 changes: 23 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>

<phpunit backupGlobals="false"
colors="true"
bootstrap="vendor/miaoxing/plugin/tests/bootstrap.php"
>

<testsuites>
<testsuite name="Default Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>src</directory>
<directory>resource</directory>
<exclude>
<directory>src/Lib</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
201 changes: 201 additions & 0 deletions public/css/vote.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
/* 投票活动样式 */
.vote-header {
margin: 0 10px;
text-align: left;
height: 50px;
line-height: 50px;
}

.vote-header .title {
font-size: 16px;
font-weight: normal;
}

.vote-header-left {
float: left;
}

.vote-header-right {
float: right;
}

.vote-header-img .title-img {
width: 100%;
}

.vote-body {
padding-top: 5px;
padding-bottom: 5px;
}

.vote-body .vote-time, .vote-body .vote-description {
text-align: left;
margin: 0 10px 0 15px;
font-size: 12px;
line-height: 20px;
}

.vote-body .vote-tips {
height: 35px;
line-height: 35px;
}

.vote-body .vote-tips.left {
margin-left: 10px;
font-size: 12px;
text-align: right;
padding: 0 5px;
}

.vote-body .vote-tips.right {
font-size: 12px;
}

.vote-join {
margin-right: 10px;
}

.vote-nav {
height: 40px;
}

.vote-work-section {
margin: 0 15px;
text-align: left;
height: 40px;
line-height: 40px;
font-size: 14px;
font-weight: normal;
}

.vote-work-section .title {
font-size: 16px;
}

.vote-work-body .description {
text-align: left;
margin: 5px 10px 0 15px;
font-size: 12px;
line-height: 20px;
}

.vote-work-body .vote-tips {
height: 35px;
line-height: 35px;
}

.vote-work-body .vote-tips.left {
margin-left: 10px;
font-size: 12px;
text-align: right;
padding: 0 5px;
}

.vote-work-body .vote-tips.right {
font-size: 12px;
}

/* 瀑布流样式 */
#masonry {
padding: 0;
min-height: 450px;
width: auto;
margin: 0 auto;
}

.thumbnail {
display: block;
padding: 4px;
line-height: 20px;
border: 1px solid #ddd;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}

#masonry .thumbnail {
width: 46%;
margin: 2%;
padding: 0;
border-width: 1px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
}

#masonry .thumbnail .header-title{
margin: 5px;
text-align: left;
font-weight: bold;
}

#masonry .thumbnail .img {
padding: 10px;
}

#masonry .thumbnail .img img {
margin-bottom: 5px;
height: auto;
max-width: 100%;
vertical-align: middle;
border: 0;
}

#masonry .thumbnail .caption {
background-color: #fff;
padding: 9px;
padding-top: 0px;
font-size: 13px;
color: #555555;
}

#masonry .thumbnail .caption .description {
font-size: 12px;
margin: 5px 0;
text-align: left;

/*多行省略*/
overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}

#masonry .thumbnail .caption .extra {
font-size: 11px;
text-align: right;
}

#masonry .thumbnail .caption .extra .vote .vote-button{
border: 1px;
border-radius: 3px;
color: #fff;
}

#masonry .thumbnail .caption .extra .vote-count {
text-align: left;
float: left;
height: 30px;
line-height: 30px;
font-size: 12px;
font-weight: bold;
}

#masonry .thumbnail .caption .extra .vote-count-num {
color: #ff4500;
}

.text-left {
float: left;
}

.text-right {
float: right;
}
56 changes: 56 additions & 0 deletions resources/views/admin/voteSettings/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php $view->layout() ?>

<div class="page-header">
<h1>
功能设置
</h1>
</div>

<div class="row">
<div class="col-xs-12">
<form action="<?= $url('admin/vote-settings/update') ?>" class="js-setting-form form-horizontal" method="post" role="form">
<div class="form-group">
<label class="col-lg-2 control-label" for="isOpen">
是否允许报名
</label>

<div class="col-lg-4">
<label class="radio-inline">
<input type="radio" class="js-vote-isOpen" name="settings[vote.isOpen]" value="1"> 开启
</label>
<label class="radio-inline">
<input type="radio" class="js-vote-isOpen" name="settings[vote.isOpen]" value="0"> 关闭
</label>
</div>

</div>

<div class="clearfix form-actions form-group">
<div class="col-lg-offset-2">
<button class="btn btn-info" type="submit">
<i class="fa fa-check bigger-110"></i>
提交
</button>
</div>
</div>
</form>
</div>
<!-- PAGE CONTENT ENDS -->
</div><!-- /.col -->
<!-- /.row -->

<?= $block('js') ?>
<script>
require(['form', 'validator'], function (form) {
$('.js-setting-form')
.loadJSON(<?= json_encode(['js-vote-isOpen' => $setting('vote.isOpen', '1')]) ?>)
.ajaxForm({
dataType: 'json',
beforeSubmit: function (arr, $form, options) {
return $form.valid();
}
})
.validate();
});
</script>
<?= $block->end() ?>
Loading

0 comments on commit 165412f

Please sign in to comment.