Merge branch 'jq_follow' into 'master'
jquery.follow See merge request IgorVBelousov/inforesurs-test!1
Этот коммит содержится в:
Коммит
0772a5eee5
2
.gitignore
поставляемый
2
.gitignore
поставляемый
@ -18,3 +18,5 @@
|
|||||||
###< symfony/web-server-bundle ###
|
###< symfony/web-server-bundle ###
|
||||||
|
|
||||||
.idea/*
|
.idea/*
|
||||||
|
node_modules/*
|
||||||
|
package-lock.json
|
||||||
|
24
Gruntfile.js
Обычный файл
24
Gruntfile.js
Обычный файл
@ -0,0 +1,24 @@
|
|||||||
|
module.exports = function (grunt) {
|
||||||
|
|
||||||
|
grunt.initConfig({
|
||||||
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
|
|
||||||
|
uglify: {
|
||||||
|
"jquery.follow": {
|
||||||
|
src: "public/js/raw/jquery.follow.js",
|
||||||
|
dest: "public/js/jquery.follow.min.js"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-internal');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-uglify-es');
|
||||||
|
|
||||||
|
grunt.registerTask('js', ['uglify']);
|
||||||
|
|
||||||
|
grunt.registerTask('default', ['js']);
|
||||||
|
};
|
@ -32,4 +32,4 @@ security:
|
|||||||
# Note: Only the *first* access control that matches will be used
|
# Note: Only the *first* access control that matches will be used
|
||||||
access_control:
|
access_control:
|
||||||
- { path: ^/admin, roles: ROLE_ADMIN }
|
- { path: ^/admin, roles: ROLE_ADMIN }
|
||||||
# - { path: ^/profile, roles: ROLE_USER }
|
- { path: ^/follow_plugin, roles: ROLE_USER }
|
||||||
|
22
package.json
Обычный файл
22
package.json
Обычный файл
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "inforesurs-test",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"devDependencies": {
|
||||||
|
"grunt": ">= 0.4.1",
|
||||||
|
"grunt-contrib-imagemin": "~3.1.0",
|
||||||
|
"grunt-contrib-internal": "~3.1.0",
|
||||||
|
"grunt-contrib-jshint": "~2.0.0",
|
||||||
|
"grunt-contrib-uglify": "~4.0.0",
|
||||||
|
"grunt-sass": "^2.1.0",
|
||||||
|
"jimp": "^0.2.28",
|
||||||
|
"node-sprite-generator": "~0.10.2",
|
||||||
|
"grunt-postcss": "~0.9.0",
|
||||||
|
"pixrem": "~4.0.1",
|
||||||
|
"cssnano": "~3.10.0",
|
||||||
|
"autoprefixer": "~8.0.0",
|
||||||
|
"grunt-contrib-clean": "^2.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"grunt-contrib-uglify-es": "github:gruntjs/grunt-contrib-uglify#harmony"
|
||||||
|
}
|
||||||
|
}
|
1
public/js/jquery.follow.min.js
поставляемый
Обычный файл
1
public/js/jquery.follow.min.js
поставляемый
Обычный файл
@ -0,0 +1 @@
|
|||||||
|
!function(o){o.fn.follow=function(){o(this).mouseover(function(f,e){var n;n=this,o("body").mousemove(function(f,e){o(n).offset({top:f.pageY,left:f.pageX}),o(n).click(function(){o("body").off("mousemove")})})})}}(jQuery);
|
18
public/js/raw/jquery.follow.js
Обычный файл
18
public/js/raw/jquery.follow.js
Обычный файл
@ -0,0 +1,18 @@
|
|||||||
|
(function ($) {
|
||||||
|
$.fn.follow = function () {
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
function follow_mouse(obj) {
|
||||||
|
$('body').mousemove(function (e, h) {
|
||||||
|
$(obj).offset({top: e.pageY, left: e.pageX});
|
||||||
|
$(obj).click(function () {
|
||||||
|
$('body').off('mousemove')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
$this.mouseover(function (e, h) {
|
||||||
|
follow_mouse(this);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})(jQuery);
|
@ -14,4 +14,12 @@ class IndexController extends AbstractController
|
|||||||
{
|
{
|
||||||
return $this->render('index.html.twig');
|
return $this->render('index.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/follow", name="follow_page", methods={"GET"})
|
||||||
|
*/
|
||||||
|
public function follow()
|
||||||
|
{
|
||||||
|
return $this->render('follow.html.twig');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
51
templates/follow.html.twig
Обычный файл
51
templates/follow.html.twig
Обычный файл
@ -0,0 +1,51 @@
|
|||||||
|
{% extends "base.html.twig" %}
|
||||||
|
{% block title %}
|
||||||
|
Плагин follow
|
||||||
|
{% endblock %}
|
||||||
|
{% block body %}
|
||||||
|
<div class="container">
|
||||||
|
<a href="{{ path('index_page') }}" class="btn btn-primary mb-5">← Главная</a>
|
||||||
|
<p>But I must explain to you how all this mistaken idea of denouncing
|
||||||
|
pleasure and <span class="text-info js-follow">praising</span> pain
|
||||||
|
was born and I will give you a complete account of the system, and
|
||||||
|
expound the actual teachings of the great explorer of the truth, the
|
||||||
|
master-builder of human happiness. No one rejects, dislikes, or
|
||||||
|
avoids pleasure itself, because it is pleasure, but because those
|
||||||
|
who do not know how to pursue pleasure rationally encounter
|
||||||
|
consequences that are extremely painful. Nor again is there anyone
|
||||||
|
who loves or pursues or desires to obtain pain of itself, because it
|
||||||
|
is pain, but because occasionally circumstances occur in which toil
|
||||||
|
and pain can procure him some great pleasure. To take a trivial
|
||||||
|
example, which of us ever undertakes laborious physical exercise,
|
||||||
|
except to obtain some advantage from it? But who has any right to
|
||||||
|
find fault with a man who chooses to enjoy a pleasure that has no
|
||||||
|
annoying consequences, or one who avoids a pain that produces no
|
||||||
|
resultant pleasure?</p>
|
||||||
|
<p><span class="text-success js-follow">follow</span></p>
|
||||||
|
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui
|
||||||
|
blanditiis <span class="text-danger js-follow">praesentium</span>
|
||||||
|
voluptatum deleniti atque corrupti quos dolores et quas molestias
|
||||||
|
excepturi sint occaecati cupiditate non provident, similique sunt in
|
||||||
|
culpa qui officia deserunt mollitia animi, id est laborum et dolorum
|
||||||
|
fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam
|
||||||
|
libero tempore, cum soluta nobis est eligendi optio cumque nihil
|
||||||
|
impedit quo minus id quod maxime placeat facere possimus, omnis
|
||||||
|
voluptas assumenda est, omnis dolor repellendus. Temporibus autem
|
||||||
|
quibusdam et aut officiis debitis aut rerum necessitatibus saepe
|
||||||
|
eveniet ut et voluptates repudiandae sint et molestiae non
|
||||||
|
recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut
|
||||||
|
aut reiciendis voluptatibus maiores alias consequatur aut
|
||||||
|
perferendis doloribus asperiores repellat.</p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% block javascripts %}
|
||||||
|
<script src="/js/jquery.follow.min.js"></script>
|
||||||
|
<script>
|
||||||
|
(function ($) {
|
||||||
|
$(function () {
|
||||||
|
$(".js-follow").follow();
|
||||||
|
});
|
||||||
|
})(jQuery);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -10,6 +10,9 @@
|
|||||||
<a href="{{ path('app_logout') }}" class="btn btn-primary">Выйти</a>
|
<a href="{{ path('app_logout') }}" class="btn btn-primary">Выйти</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br class="mb-5">
|
<br class="mb-5">
|
||||||
|
{% if is_granted('ROLE_USER') %}
|
||||||
|
<a href="{{ path('follow_page') }}" class="btn btn-primary">Плагин follow</a>
|
||||||
|
{% endif %}
|
||||||
{% if is_granted('ROLE_ADMIN') %}
|
{% if is_granted('ROLE_ADMIN') %}
|
||||||
<a href="{{ path('user_index') }}" class="btn btn-primary">Список пользователей</a>
|
<a href="{{ path('user_index') }}" class="btn btn-primary">Список пользователей</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user