Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
492942dd
Commit
492942dd
authored
Feb 20, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Активировать формы в блоге
parent
a7ec3a99
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
456 additions
and
43 deletions
+456
-43
common/modules/blog/controllers/PostController.php
common/modules/blog/controllers/PostController.php
+102
-27
common/modules/blog/views/post/_mail.php
common/modules/blog/views/post/_mail.php
+4
-0
common/modules/blog/views/post/_modals.php
common/modules/blog/views/post/_modals.php
+147
-0
common/modules/blog/views/post/_sidebar.php
common/modules/blog/views/post/_sidebar.php
+5
-5
common/modules/blog/views/post/_subscribe.php
common/modules/blog/views/post/_subscribe.php
+1
-1
common/modules/blog/views/post/index.php
common/modules/blog/views/post/index.php
+1
-1
common/modules/blog/views/post/tag.php
common/modules/blog/views/post/tag.php
+1
-1
common/modules/blog/views/post/view.php
common/modules/blog/views/post/view.php
+1
-1
frontend/views/layouts/block/callback.php
frontend/views/layouts/block/callback.php
+1
-1
frontend/views/layouts/block/case-more.php
frontend/views/layouts/block/case-more.php
+1
-1
frontend/views/layouts/block/case-subscribe.php
frontend/views/layouts/block/case-subscribe.php
+1
-1
frontend/views/layouts/foot.php
frontend/views/layouts/foot.php
+1
-1
frontend/views/layouts/footer-index.php
frontend/views/layouts/footer-index.php
+1
-1
frontend/views/site/contacts.php
frontend/views/site/contacts.php
+1
-1
frontend/web/css/custom.css
frontend/web/css/custom.css
+187
-0
frontend/web/images/blog_form_img.png
frontend/web/images/blog_form_img.png
+0
-0
frontend/web/js/connect-form.js
frontend/web/js/connect-form.js
+1
-1
No files found.
common/modules/blog/controllers/PostController.php
View file @
492942dd
...
...
@@ -6,7 +6,9 @@ use Yii;
use
common\components\BaseController
;
use
yii\web\NotFoundHttpException
;
use
yii\web\Response
;
use
yii\widgets\ActiveForm
;
use
common\models\Settings
;
use
common\modules\blog\models\Post
;
use
common\modules\blog\models\PostTag
;
use
common\modules\blog\models\PostTagAssign
;
...
...
@@ -23,6 +25,7 @@ class PostController extends BaseController
'Load'
=>
'Подгрузка записей'
,
'Tag'
=>
'Просмотр тега'
,
'View'
=>
'Просмотр записи'
,
'Send-article'
=>
'Послать статью'
,
];
}
...
...
@@ -43,7 +46,46 @@ class PostController extends BaseController
}
/**
* Displays all Post models.
* Displays a single Post model.
* @param string $url
* @return mixed
*/
public
function
actionTag
(
$tag
)
{
$model
=
PostTag
::
find
()
->
where
([
'name'
=>
$tag
])
->
one
();
if
(
!
$model
||
!
$model
->
posts
)
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
$this
->
meta_title
=
Yii
::
t
(
'app'
,
'Tag'
)
.
': '
.
$model
->
name
.
' - '
.
\Yii
::
$app
->
params
[
'name'
];
return
$this
->
render
(
'tag'
,
[
'model'
=>
$model
,
'count'
=>
$model
->
getAllPosts
()
->
count
()
]);
}
/**
* Displays a single Post model.
* @param string $url
* @return mixed
*/
public
function
actionView
(
$url
)
{
$model
=
$this
->
findModelByUrl
(
$url
);
$this
->
meta_title
=
$model
->
metaTag
->
title
.
' - '
.
\Yii
::
$app
->
params
[
'name'
];
$this
->
meta_description
=
$model
->
metaTag
->
description
;
$this
->
meta_keywords
=
$model
->
metaTag
->
keywords
;
return
$this
->
render
(
'view'
,
[
'model'
=>
$model
,
]);
}
/**
* @return mixed
*/
public
function
actionLoad
()
...
...
@@ -80,43 +122,76 @@ class PostController extends BaseController
}
/**
* Displays a single Post model.
* @param string $url
* @return mixed
*/
public
function
action
Tag
(
$tag
)
public
function
action
SendArticle
(
)
{
$model
=
PostTag
::
find
()
->
where
([
'name'
=>
$tag
])
->
one
();
if
(
!
$model
||
!
$model
->
posts
)
if
(
Yii
::
$app
->
request
->
isAjax
)
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
Yii
::
$app
->
response
->
format
=
Response
::
FORMAT_JSON
;
$this
->
meta_title
=
Yii
::
t
(
'app'
,
'Tag'
)
.
': '
.
$model
->
name
.
' - '
.
\Yii
::
$app
->
params
[
'name'
]
;
$model
=
$this
->
getModel
()
;
return
$this
->
render
(
'tag'
,
[
'model'
=>
$model
,
'count'
=>
$model
->
getAllPosts
()
->
count
()
$model
->
load
(
Yii
::
$app
->
request
->
post
());
if
(
$model
->
validate
())
{
try
{
$email
=
'Levshin@kupitsite.ru'
;
$message
=
$this
->
renderPartial
(
'_mail'
,
[
'model'
=>
$model
]);
$headers
=
"MIME-Version: 1.0
\r\n
"
.
"Content-Transfer-Encoding: 8bit
\r\n
"
.
"Content-Type: text/html; charset=
\"
UTF-8
\"\r\n
"
.
"X-Mailer: PHP v."
.
phpversion
()
.
"
\r\n
"
.
"From: Блог на task-on.com <"
.
Settings
::
getValue
(
'bids-support-email-from'
)
.
">
\r\n
"
;
switch
(
$model
->
form
)
{
case
'theme'
:
$subject
=
"Блог. Предложить тему"
;
break
;
case
'article'
:
$subject
=
"Блог. Статья"
;
break
;
}
/**
* Displays a single Post model.
* @param string $url
* @return mixed
*/
public
function
actionView
(
$url
)
@
mail
(
$email
,
$subject
,
$message
,
$headers
);
}
catch
(
Exception
$e
)
{
$model
=
$this
->
findModelByUrl
(
$url
);
}
$this
->
meta_title
=
$model
->
metaTag
->
title
.
' - '
.
\Yii
::
$app
->
params
[
'name'
];
$this
->
meta_description
=
$model
->
metaTag
->
description
;
$this
->
meta_keywords
=
$model
->
metaTag
->
keywords
;
return
[
'success'
=>
true
];
}
else
{
return
ActiveForm
::
validate
(
$model
);
}
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
}
return
$this
->
render
(
'view'
,
[
'model'
=>
$model
,
// Temp metod
public
function
getModel
()
{
$model
=
new
\yii\base\DynamicModel
([
'name'
,
'email'
,
'message'
,
'form'
]);
$model
->
addRule
([
'name'
,
'email'
,
'message'
],
'required'
)
->
addRule
([
'email'
],
'email'
)
->
addRule
([
'message'
,
'name'
,
'form'
],
'string'
);
return
$model
;
}
/**
...
...
common/modules/blog/views/post/_mail.php
0 → 100644
View file @
492942dd
Имя Фамилия:
<?=
$model
->
name
?>
<br>
Email:
<?=
$model
->
email
?>
<br>
<hr>
<?=
$model
->
message
?>
\ No newline at end of file
common/modules/blog/views/post/_modals.php
0 → 100644
View file @
492942dd
<?php
use
yii\widgets\ActiveForm
;
use
yii\helpers\Html
;
use
common\modules\bids\models\Bid
;
?>
<div
class=
"hidden"
>
<div
id=
"blog_form"
class=
"popup popup_2 blog_form"
>
<span
class=
"popup__title"
>
Предложить тему для блога
</span>
<?php
$model
=
\Yii
::
$app
->
controller
->
getModel
();
$model
->
form
=
'article'
;
$form
=
ActiveForm
::
begin
([
'action'
=>
'/blog/post/send-article'
,
'enableClientValidation'
=>
false
,
'options'
=>
[
'class'
=>
'valid_form bids-form blog-form'
,
'data-title'
=>
'Предложить тему для блога'
,
'data-form'
=>
'Предложить тему для блога'
,
'data-tag'
=>
Bid
::
TAG_TREATMENT
],
]);
?>
<?php
echo
$form
->
field
(
$model
,
'form'
,
[
'template'
=>
'{input}'
])
->
hiddenInput
([
'class'
=>
'not_clear'
]);
?>
<div
class=
"blog_form_left form_resp"
>
<div>
<?php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'placeholder'
=>
'Имя Фамилия'
,
'class'
=>
'input_st'
])
->
label
(
false
);
?>
<?php
echo
$form
->
field
(
$model
,
'email'
)
->
textInput
([
'placeholder'
=>
'E-mail'
,
'class'
=>
'input_st'
])
->
label
(
false
);
?>
</div>
</div>
<div
class=
"blog_form_right form_resp"
>
<p><strong>
Вы можете предложить статью для публикации или написать нам о том, что бы было интересно почитать.
</strong></p>
<p><strong>
Мы с радостью поделимся своим опытом и напишем интересную статью.
</strong></p>
</div>
<div
class=
"blog_lmg"
>
<img
src=
"/images/blog_form_img.png"
height=
"123"
width=
"118"
alt=
""
>
</div>
<div
class=
"clear"
></div>
<br>
<?php
echo
$form
->
field
(
$model
,
'message'
)
->
textArea
([
'placeholder'
=>
'Что хочу почитать?
Например: Хочу почитать про то, как настраивается контекстная реклама.
Про то как выставляются ставки.'
,
'class'
=>
'sect_cont_form__textarea'
])
->
label
(
false
);
?>
<div
class=
"clear"
></div>
<?php
echo
Html
::
submitButton
(
'Предложить тему'
,
[
'class'
=>
'save-button btn-default button-lg'
]);
?>
<?php
ActiveForm
::
end
();
?>
</div>
<div
id=
"blog_form_2"
class=
"popup popup_2 blog_form_2"
>
<!-- <div class="txtbtnclose">Закрыть</div> -->
<span
class=
"popup__title"
>
Предложить тему для блога
</span>
<p><strong>
Мы готовы бесплатно поделиться накопленным опытом, если вы сообщите тему которая вас интересует
</strong></p>
<br>
<?php
$model
=
\Yii
::
$app
->
controller
->
getModel
();
$model
->
form
=
'theme'
;
$form
=
ActiveForm
::
begin
([
'action'
=>
'/blog/post/send-article'
,
'enableClientValidation'
=>
false
,
'options'
=>
[
'class'
=>
'valid_form bids-form blog-form'
,
'data-title'
=>
'Предложить тему для блога'
,
'data-form'
=>
'Предложить тему для блога'
,
'data-tag'
=>
Bid
::
TAG_TREATMENT
],
]);
?>
<?php
echo
$form
->
field
(
$model
,
'form'
,
[
'template'
=>
'{input}'
])
->
hiddenInput
([
'class'
=>
'not_clear'
]);
?>
<div
class=
"blog_form_left50 form_resp"
>
<div>
<?php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'placeholder'
=>
'Имя Фамилия'
,
'class'
=>
'input_st'
])
->
label
(
false
);
?>
</div>
</div>
<div
class=
"blog_form_right50 form_resp"
>
<?php
echo
$form
->
field
(
$model
,
'email'
)
->
textInput
([
'placeholder'
=>
'E-mail'
,
'class'
=>
'input_st'
])
->
label
(
false
);
?>
</div>
<div
class=
"clear"
></div>
<?php
echo
$form
->
field
(
$model
,
'message'
)
->
textArea
([
'placeholder'
=>
'Что хочу почитать?
Например: Хочу почитать про то, как настраивается контекстная реклама.
Про то как выставляются ставки.'
,
'class'
=>
'sect_cont_form__textarea'
])
->
label
(
false
);
?>
<div
class=
"clear"
></div>
<?php
echo
Html
::
submitButton
(
'Предложить тему'
,
[
'class'
=>
'save-button btn-default button-lg'
]);
?>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
<style>
.blog-form
input
,
.blog-form
textarea
{
margin-bottom
:
10px
!important
;
}
</style>
\ No newline at end of file
common/modules/blog/views/post/_sidebar.php
View file @
492942dd
...
...
@@ -29,15 +29,15 @@ use common\models\Settings;
</div>
</div>
<
!-- <
div class="sidebar_module">
<div
class=
"sidebar_module"
>
<div
class=
"sidebar_module_body"
>
<a href="#
" class="sidebar_btn
">
<a
href=
"#
blog_form_2"
class=
"sidebar_btn popup-form
"
>
Предложить тему
<div
class=
"blog_toltip_right"
>
Предложите свою тему и мы напишем
</div>
</a>
<a href="#" class="sidebar_btn">Послать статью</a>
<a
href=
"#blog_form"
class=
"sidebar_btn popup-form"
>
Послать статью
</a>
</div>
</div>
</div> -->
<?php
$posts
=
Post
::
find
();
if
(
$model
)
...
...
common/modules/blog/views/post/_subscribe.php
View file @
492942dd
...
...
@@ -15,7 +15,7 @@ use common\modules\bids\models\Bid;
$model
->
form
=
Bid
::
FORM_SUBSCRIBE
;
$form
=
ActiveForm
::
begin
([
'action'
=>
'/'
,
'action'
=>
'/
bids/bid/add
'
,
'enableClientValidation'
=>
false
,
'options'
=>
[
'class'
=>
'subsc_blog_form bids-form'
,
...
...
common/modules/blog/views/post/index.php
View file @
492942dd
...
...
@@ -45,6 +45,6 @@ use common\modules\blog\models\Post;
</div>
</div>
<
!-- <div class="end_keys_neft"></div> --
>
<
?=
$this
->
render
(
'_modals'
)
?
>
<?=
$this
->
render
(
'@app/views/layouts/footer'
);
?>
\ No newline at end of file
common/modules/blog/views/post/tag.php
View file @
492942dd
...
...
@@ -45,6 +45,6 @@ use common\modules\blog\models\Post;
</div>
</div>
<
!-- <div class="end_keys_neft"></div> --
>
<
?=
$this
->
render
(
'_modals'
)
?
>
<?=
$this
->
render
(
'@app/views/layouts/footer'
);
?>
\ No newline at end of file
common/modules/blog/views/post/view.php
View file @
492942dd
...
...
@@ -61,6 +61,6 @@ use yii\helpers\Html;
</div>
</div>
<
!-- <div class="end_keys_neft"></div> --
>
<
?=
$this
->
render
(
'_modals'
)
?
>
<?=
$this
->
render
(
'@app/views/layouts/footer'
);
?>
frontend/views/layouts/block/callback.php
View file @
492942dd
...
...
@@ -17,7 +17,7 @@ use common\modules\bids\models\Bid;
$model
->
form
=
Bid
::
FORM_CALLBACK
;
$form
=
ActiveForm
::
begin
([
'action'
=>
'/'
,
'action'
=>
'/
bids/bid/add
'
,
'enableClientValidation'
=>
false
,
'options'
=>
[
'class'
=>
'valid_form bids-form'
,
...
...
frontend/views/layouts/block/case-more.php
View file @
492942dd
...
...
@@ -48,7 +48,7 @@ $more = CoContent::find()
$model
->
form
=
Bid
::
FORM_SUBSCRIBE
;
$form
=
ActiveForm
::
begin
([
'action'
=>
'/'
,
'action'
=>
'/
bids/bid/add
'
,
'enableClientValidation'
=>
false
,
'options'
=>
[
'class'
=>
'subsc_form bids-form'
,
...
...
frontend/views/layouts/block/case-subscribe.php
View file @
492942dd
...
...
@@ -15,7 +15,7 @@ use common\modules\bids\models\Bid;
$model
->
form
=
Bid
::
FORM_SUBSCRIBE
;
$form
=
ActiveForm
::
begin
([
'action'
=>
'/'
,
'action'
=>
'/
bids/bid/add
'
,
'enableClientValidation'
=>
false
,
'options'
=>
[
'class'
=>
'keys_mail_form bids-form'
,
...
...
frontend/views/layouts/foot.php
View file @
492942dd
...
...
@@ -24,5 +24,5 @@
<?php
$this
->
registerJsFile
(
'/js/common.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/jquery.form.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/
bids
-form.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/
connect
-form.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/custom.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
\ No newline at end of file
frontend/views/layouts/footer-index.php
View file @
492942dd
...
...
@@ -22,7 +22,7 @@ use common\modules\bids\models\Bid;
$form
=
ActiveForm
::
begin
([
'id'
=>
'form_foot'
,
'action'
=>
'/'
,
'action'
=>
'/
bids/bid/add
'
,
'enableClientValidation'
=>
false
,
'options'
=>
[
'class'
=>
'footer_form bids-form'
,
...
...
frontend/views/site/contacts.php
View file @
492942dd
...
...
@@ -86,7 +86,7 @@ use \common\modules\bids\models\Bid;
$form
=
ActiveForm
::
begin
([
'id'
=>
'form_foot'
,
'action'
=>
'/'
,
'action'
=>
'/
bids/bid/add
'
,
'enableClientValidation'
=>
false
,
'options'
=>
[
'class'
=>
'sect_cont_form bids-form'
,
...
...
frontend/web/css/custom.css
View file @
492942dd
...
...
@@ -182,6 +182,193 @@ a.toggle_bottom:hover .icon-arrowDown2:after, a.toggle_bottom:active .icon-arrow
display
:
none
;
}
/* ------------ BLOG MODAL ------------------ */
.clear
{
clear
:
both
;
}
.support_form
{
width
:
760px
;
padding
:
30px
;
padding-bottom
:
40px
;
color
:
#525252
;
}
.popup_2
.popup__title
{
font-size
:
38px
;
font-weight
:
bold
;
color
:
#344555
;
text-align
:
left
;
}
.support_form_left
{
width
:
45%
;
float
:
left
;
padding-right
:
15px
;
}
.support_form_right
{
width
:
55%
;
float
:
right
;
padding-left
:
15px
;
}
.popup_2
p
{
font-size
:
17px
;
color
:
#525252
;
line-height
:
22px
;
font-weight
:
400
;
}
.support_form
.support_block__link_pv
{
margin-top
:
10px
;
}
.popup_2
input
:not
([
type
=
"radio"
])
:not
([
type
=
"checkbox"
])
{
border-radius
:
10px
;
-moz-border-radius
:
10px
;
-webkit-border-radius
:
10px
;
-o-border-radius
:
10px
;
-ms-border-radius
:
10px
;
width
:
100%
;
}
.popup_2
input
{
margin-bottom
:
10px
;
}
.popup_2
input
:not
(
:last-child
)
{
margin-bottom
:
30px
;
}
.popup_2
.checkbox
:not
(
checked
)
+
label
{
position
:
relative
;
padding
:
6px
0px
0px
28px
;
margin-bottom
:
30px
;
}
.popup_2
label
{
margin-bottom
:
10px
;
}
.support_form_left2
{
float
:
left
;
width
:
50%
;
padding-right
:
15px
;
}
.support_form_right2
{
float
:
right
;
width
:
50%
;
padding-left
:
15px
;
margin-bottom
:
30px
;
}
.popup_2
.sect_cont_form__textarea
{
background-color
:
#f1f1f1
;
height
:
170px
;
width
:
100%
;
line-height
:
24px
;
resize
:
none
;
}
.file-upload_block_cs2
{
height
:
170px
;
background-color
:
#f8f8f8
;
padding-top
:
30px
;
border
:
2px
solid
#f1f1f1
;
border-radius
:
10px
;
-moz-border-radius
:
10px
;
-webkit-border-radius
:
10px
;
-o-border-radius
:
10px
;
-ms-border-radius
:
10px
;
}
.file-upload_block_cs2
.filename_cs
{
background-color
:
#f8f8f8
;
margin-bottom
:
0px
!important
;
}
.button-lg
{
padding-left
:
30px
;
padding-right
:
30px
;
width
:
auto
;
}
.blog_form
{
width
:
820px
;
padding
:
30px
;
padding-bottom
:
40px
;
color
:
#525252
;
}
.blog_form_left
{
width
:
280px
;
float
:
left
;
padding-right
:
18px
;
}
.blog_form_right
{
width
:
340px
;
float
:
left
;
font-size
:
15px
;
}
.blog_form_right
p
{
font-size
:
15px
;
}
.blog_lmg
{
float
:
right
;
}
.blog_form_2
{
width
:
670px
;
padding
:
30px
;
padding-bottom
:
40px
;
color
:
#525252
;
}
.blog_form_left50
{
float
:
left
;
width
:
50%
;
padding-right
:
15px
;
}
.blog_form_right50
{
float
:
right
;
width
:
50%
;
padding-left
:
15px
;
}
@media
only
screen
and
(
max-width
:
992px
)
{
.blog_form_2
,
.blog_form
,
.support_form
{
width
:
100%
;
height
:
auto
;
}
.popup_2
.popup__title
{
font-size
:
32px
;
}
}
@media
only
screen
and
(
max-width
:
820px
)
{
.blog_lmg
{
display
:
none
;
}
}
@media
only
screen
and
(
max-width
:
767px
)
{
.form_resp
{
float
:
none
;
width
:
100%
;
padding-left
:
0
;
padding-right
:
0
;
}
.support_form_right
{
margin-bottom
:
20px
;
}
}
@media
only
screen
and
(
max-width
:
479px
)
{
.popup_2
.popup__title
{
font-size
:
22px
;
}
.blog_form_right
{
width
:
100%
;
}
}
/* ------------ BLOG MODAL ------------------ */
@media
(
min-width
:
970px
)
{
.article_short_txt
img
{
width
:
auto
!important
;
...
...
frontend/web/images/blog_form_img.png
0 → 100644
View file @
492942dd
3.82 KB
frontend/web/js/
bids
-form.js
→
frontend/web/js/
connect
-form.js
View file @
492942dd
...
...
@@ -15,7 +15,7 @@ $('form.bids-form').on('beforeSubmit', function(e) {
data
.
append
(
"
Bid[file]
"
,
file
);
}
xhr
.
open
(
"
POST
"
,
'
/bids/bid/add
'
,
true
);
xhr
.
open
(
"
POST
"
,
form
.
attr
(
'
action
'
)
,
true
);
xhr
.
setRequestHeader
(
"
X-Requested-With
"
,
"
XMLHttpRequest
"
);
xhr
.
send
(
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment